address clippy::all lints (#486)

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

View file

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

View file

@ -242,10 +242,7 @@ impl Database {
),
);
Database {
humans: humans,
droids: droids,
}
Database { humans, droids }
}
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));
let mut definition = util::GraphQLTypeDefiniton {
name: name,
name,
_type: target_type.clone(),
context: impl_attrs.context,
scalar: impl_attrs.scalar,

View file

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

View file

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

View file

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