Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteada3b9

Browse files
committed
clippy clean
1 parentbadf489 commiteada3b9

File tree

5 files changed

+16
-26
lines changed

5 files changed

+16
-26
lines changed

‎integrations/actix-web/src/request.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl FromRequest for GraphQLBatchRequest {
8181

8282
if req.method() ==Method::GET{
8383
let res = async_graphql::http::parse_query_string(req.query_string())
84-
.map_err(|err|io::Error::new(ErrorKind::Other, err));
84+
.map_err(io::Error::other);
8585
Box::pin(asyncmove{Ok(Self(async_graphql::BatchRequest::Single(res?)))})
8686
}elseif req.method() ==Method::POST{
8787
let content_type = req
@@ -120,13 +120,13 @@ impl FromRequest for GraphQLBatchRequest {
120120
"a payload reached size limit",
121121
),
122122
PayloadError::UnknownLength =>{
123-
io::Error::new(ErrorKind::Other,"a payload length is unknown")
123+
io::Error::other("a payload length is unknown")
124124
}
125125
#[cfg(feature ="http2")]
126126
PayloadError::Http2Payload(e)if e.is_io() => e.into_io().unwrap(),
127127
#[cfg(feature ="http2")]
128-
PayloadError::Http2Payload(e) => io::Error::new(ErrorKind::Other,e),
129-
_ => io::Error::new(ErrorKind::Other,e),
128+
PayloadError::Http2Payload(e) => io::Error::other(e),
129+
_ => io::Error::other(e),
130130
})
131131
.into_async_read(),
132132
config,

‎integrations/axum/src/extract.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{io::ErrorKind,marker::PhantomData};
1+
use std::marker::PhantomData;
22

33
use async_graphql::{ParseRequestError, futures_util::TryStreamExt, http::MultipartOptions};
44
use axum::{
@@ -101,10 +101,10 @@ where
101101
let uri = req.uri();
102102
let res = async_graphql::http::parse_query_string(uri.query().unwrap_or_default())
103103
.map_err(|err|{
104-
ParseRequestError::Io(std::io::Error::new(
105-
ErrorKind::Other,
106-
format!("failed to parse graphql request from uri query: {}",err),
107-
))
104+
ParseRequestError::Io(std::io::Error::other(format!(
105+
"failed to parse graphql request from uri query: {}",
106+
err
107+
)))
108108
});
109109
Ok(Self(async_graphql::BatchRequest::Single(res?),PhantomData))
110110
}else{
@@ -116,7 +116,7 @@ where
116116
let body_stream = req
117117
.into_body()
118118
.into_data_stream()
119-
.map_err(|err| std::io::Error::new(ErrorKind::Other,err.to_string()));
119+
.map_err(|err| std::io::Error::other(err.to_string()));
120120
let body_reader = tokio_util::io::StreamReader::new(body_stream).compat();
121121
Ok(Self(
122122
async_graphql::http::receive_batch_body(

‎integrations/warp/src/batch_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{io,io::ErrorKind,str::FromStr};
1+
use std::{io, str::FromStr};
22

33
use async_graphql::{BatchRequest,Executor, http::MultipartOptions};
44
use futures_util::TryStreamExt;
@@ -46,7 +46,7 @@ where
4646
.and_then(move |content_type, body|asyncmove{
4747
async_graphql::http::receive_batch_body(
4848
content_type,
49-
TryStreamExt::map_err(body,|e|io::Error::new(ErrorKind::Other, e))
49+
TryStreamExt::map_err(body, io::Error::other)
5050
.map_ok(|mut buf|{
5151
let remaining =Buf::remaining(&buf);
5252
Buf::copy_to_bytes(&mut buf, remaining)

‎src/error.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ impl ServerError {
102102
/// #[Object]
103103
/// impl Query {
104104
/// async fn value(&self) -> Result<i32> {
105-
/// Err(Error::new_with_source(std::io::Error::new(
106-
/// ErrorKind::Other,
107-
/// "my error",
108-
/// )))
105+
/// Err(Error::new_with_source(std::io::Error::other("my error")))
109106
/// }
110107
/// }
111108
///

‎src/http/mod.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ mod multipart_subscribe;
1414
mod playground_source;
1515
mod websocket;
1616

17-
use std::io::ErrorKind;
18-
1917
#[cfg(feature ="altair")]
2018
pubuse altair_source::*;
2119
use futures_util::io::{AsyncRead,AsyncReadExt};
@@ -49,23 +47,18 @@ pub fn parse_query_string(input: &str) -> Result<Request, ParseRequestError> {
4947
pubextensions:Option<String>,
5048
}
5149

52-
let request:RequestSerde = serde_urlencoded::from_str(input)
53-
.map_err(|err| std::io::Error::new(ErrorKind::Other, err))?;
50+
let request:RequestSerde = serde_urlencoded::from_str(input).map_err(std::io::Error::other)?;
5451
let variables = request
5552
.variables
5653
.map(|data| serde_json::from_str(&data))
5754
.transpose()
58-
.map_err(|err|{
59-
std::io::Error::new(ErrorKind::Other,format!("invalid variables: {}", err))
60-
})?
55+
.map_err(|err| std::io::Error::other(format!("invalid variables: {}", err)))?
6156
.unwrap_or_default();
6257
let extensions = request
6358
.extensions
6459
.map(|data| serde_json::from_str(&data))
6560
.transpose()
66-
.map_err(|err|{
67-
std::io::Error::new(ErrorKind::Other,format!("invalid extensions: {}", err))
68-
})?
61+
.map_err(|err| std::io::Error::other(format!("invalid extensions: {}", err)))?
6962
.unwrap_or_default();
7063

7164
Ok(Request{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp