address clippy::all lints ()

This commit is contained in:
danieleades 2019-12-18 04:37:46 +00:00 committed by Christian Legnitto
parent f0ba1c07da
commit 6fa6c20fa7
6 changed files with 17 additions and 22 deletions
integration_tests/async_await/src
juniper/src/tests
juniper_codegen/src
juniper_iron/src
rustfmt.toml

View file

@ -20,14 +20,13 @@ impl User {
} }
async fn friends(&self) -> Vec<User> { async fn friends(&self) -> Vec<User> {
let friends = (0..10) (0..10)
.map(|index| User { .map(|index| User {
id: index, id: index,
name: format!("user{}", index), name: format!("user{}", index),
kind: UserKind::User, kind: UserKind::User,
}) })
.collect(); .collect()
friends
} }
async fn kind(&self) -> &UserKind { async fn kind(&self) -> &UserKind {

View file

@ -242,10 +242,7 @@ impl Database {
), ),
); );
Database { Database { humans, droids }
humans: humans,
droids: droids,
}
} }
pub fn get_hero(&self, episode: Option<Episode>) -> &dyn Character { pub fn get_hero(&self, episode: Option<Episode>) -> &dyn Character {

View file

@ -58,7 +58,7 @@ pub fn build_object(args: TokenStream, body: TokenStream, is_internal: bool) ->
.or(util::get_doc_comment(&_impl.attrs)); .or(util::get_doc_comment(&_impl.attrs));
let mut definition = util::GraphQLTypeDefiniton { let mut definition = util::GraphQLTypeDefiniton {
name: name, name,
_type: target_type.clone(), _type: target_type.clone(),
context: impl_attrs.context, context: impl_attrs.context,
scalar: impl_attrs.scalar, scalar: impl_attrs.scalar,

View file

@ -509,9 +509,7 @@ impl parse::Parse for FieldAttribute {
} else { } else {
None None
}; };
Ok(FieldAttribute::Deprecation(DeprecationAttr { Ok(FieldAttribute::Deprecation(DeprecationAttr { reason }))
reason: reason,
}))
} }
"skip" => Ok(FieldAttribute::Skip(ident)), "skip" => Ok(FieldAttribute::Skip(ident)),
"arguments" => { "arguments" => {

View file

@ -155,11 +155,11 @@ where
QueryT: GraphQLType<S, Context = CtxT>, QueryT: GraphQLType<S, Context = CtxT>,
MutationT: GraphQLType<S, Context = CtxT>, MutationT: GraphQLType<S, Context = CtxT>,
{ {
match self { match *self {
&GraphQLBatchRequest::Single(ref request) => { GraphQLBatchRequest::Single(ref request) => {
GraphQLBatchResponse::Single(request.execute(root_node, context)) GraphQLBatchResponse::Single(request.execute(root_node, context))
} }
&GraphQLBatchRequest::Batch(ref requests) => GraphQLBatchResponse::Batch( GraphQLBatchRequest::Batch(ref requests) => GraphQLBatchResponse::Batch(
requests requests
.iter() .iter()
.map(|request| request.execute(root_node, context)) .map(|request| request.execute(root_node, context))
@ -174,11 +174,11 @@ where
S: ScalarValue, S: ScalarValue,
{ {
fn is_ok(&self) -> bool { fn is_ok(&self) -> bool {
match self { match *self {
&GraphQLBatchResponse::Single(ref response) => response.is_ok(), GraphQLBatchResponse::Single(ref response) => response.is_ok(),
&GraphQLBatchResponse::Batch(ref responses) => responses GraphQLBatchResponse::Batch(ref responses) => {
.iter() responses.iter().all(|response| response.is_ok())
.fold(true, |ok, response| ok && response.is_ok()), }
} }
} }
} }
@ -263,7 +263,7 @@ where
/// the schema needs to execute the query. /// the schema needs to execute the query.
pub fn new(context_factory: CtxFactory, query: Query, mutation: Mutation) -> Self { pub fn new(context_factory: CtxFactory, query: Query, mutation: Mutation) -> Self {
GraphQLHandler { GraphQLHandler {
context_factory: context_factory, context_factory,
root_node: RootNode::new(query, mutation), root_node: RootNode::new(query, mutation),
} }
} }
@ -513,9 +513,9 @@ mod tests {
let body = response::extract_body_to_string(response); let body = response::extract_body_to_string(response);
http_tests::TestResponse { http_tests::TestResponse {
status_code: status_code, status_code,
body: Some(body), body: Some(body),
content_type: content_type, content_type,
} }
} }

View file

@ -1 +1,2 @@
merge_imports = true merge_imports = true
use_field_init_shorthand = true