diff --git a/benches/bench.rs b/benches/bench.rs index c194b0d0..331a2ccc 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -1,4 +1,5 @@ -#[macro_use] extern crate bencher; +#[macro_use] +extern crate bencher; extern crate juniper; use bencher::Bencher; diff --git a/examples/warp_subscriptions/src/main.rs b/examples/warp_subscriptions/src/main.rs index 86453608..2c4109b7 100644 --- a/examples/warp_subscriptions/src/main.rs +++ b/examples/warp_subscriptions/src/main.rs @@ -144,9 +144,7 @@ async fn main() { let homepage = warp::path::end().map(|| { Response::builder() .header("content-type", "text/html") - .body(format!( - "<html><h1>juniper_subscriptions demo</h1><div>visit <a href=\"/playground\">graphql playground</a></html>" - )) + .body("<html><h1>juniper_subscriptions demo</h1><div>visit <a href=\"/playground\">graphql playground</a></html>".to_string()) }); let qm_schema = schema(); diff --git a/integration_tests/async_await/src/main.rs b/integration_tests/async_await/src/main.rs index 61d47c0c..955bbe15 100644 --- a/integration_tests/async_await/src/main.rs +++ b/integration_tests/async_await/src/main.rs @@ -9,6 +9,7 @@ enum UserKind { } struct User { + #[allow(dead_code)] id: i32, name: String, kind: UserKind, diff --git a/integration_tests/juniper_tests/src/codegen/derive_enum.rs b/integration_tests/juniper_tests/src/codegen/derive_enum.rs index 0e967bcb..5dc1848e 100644 --- a/integration_tests/juniper_tests/src/codegen/derive_enum.rs +++ b/integration_tests/juniper_tests/src/codegen/derive_enum.rs @@ -4,8 +4,6 @@ use fnv::FnvHashMap; #[cfg(test)] use juniper::{self, DefaultScalarValue, FromInputValue, GraphQLType, InputValue, ToInputValue}; -use futures; - #[derive(juniper::GraphQLEnum, Debug, PartialEq)] #[graphql(name = "Some", description = "enum descr")] enum SomeEnum { diff --git a/integration_tests/juniper_tests/src/codegen/derive_object.rs b/integration_tests/juniper_tests/src/codegen/derive_object.rs index 6e62489d..b7dd51ca 100644 --- a/integration_tests/juniper_tests/src/codegen/derive_object.rs +++ b/integration_tests/juniper_tests/src/codegen/derive_object.rs @@ -9,8 +9,6 @@ use juniper::{ self, execute, EmptyMutation, EmptySubscription, GraphQLType, RootNode, Value, Variables, }; -use futures; - #[derive(GraphQLObject, Debug, PartialEq)] #[graphql( name = "MyObj", @@ -333,7 +331,7 @@ async fn check_descriptions( "#, object_name ); - run_type_info_query(&doc, |(type_info, values)| { + let _result = run_type_info_query(&doc, |(type_info, values)| { assert_eq!( type_info.get_field_value("name"), Some(&Value::scalar(object_name)) diff --git a/integration_tests/juniper_tests/src/codegen/derive_object_with_raw_idents.rs b/integration_tests/juniper_tests/src/codegen/derive_object_with_raw_idents.rs index 29a10174..b043425a 100644 --- a/integration_tests/juniper_tests/src/codegen/derive_object_with_raw_idents.rs +++ b/integration_tests/juniper_tests/src/codegen/derive_object_with_raw_idents.rs @@ -4,8 +4,6 @@ use juniper::{ Value, Variables, }; -use futures; - pub struct Query; #[juniper::graphql_object] diff --git a/integration_tests/juniper_tests/src/codegen/impl_union.rs b/integration_tests/juniper_tests/src/codegen/impl_union.rs index 8e039335..5ed28a3f 100644 --- a/integration_tests/juniper_tests/src/codegen/impl_union.rs +++ b/integration_tests/juniper_tests/src/codegen/impl_union.rs @@ -1,5 +1,3 @@ -use futures; - // Trait. #[derive(juniper::GraphQLObject)] diff --git a/integration_tests/juniper_tests/src/codegen/scalar_value_transparent.rs b/integration_tests/juniper_tests/src/codegen/scalar_value_transparent.rs index f4861bcb..6f52e5b6 100644 --- a/integration_tests/juniper_tests/src/codegen/scalar_value_transparent.rs +++ b/integration_tests/juniper_tests/src/codegen/scalar_value_transparent.rs @@ -1,5 +1,4 @@ use fnv::FnvHashMap; -use futures; use juniper::{DefaultScalarValue, FromInputValue, GraphQLType, InputValue, ToInputValue}; #[derive(juniper::GraphQLScalarValue, PartialEq, Eq, Debug)] diff --git a/integration_tests/juniper_tests/src/custom_scalar.rs b/integration_tests/juniper_tests/src/custom_scalar.rs index 33418adc..775c1f7f 100644 --- a/integration_tests/juniper_tests/src/custom_scalar.rs +++ b/integration_tests/juniper_tests/src/custom_scalar.rs @@ -1,7 +1,5 @@ extern crate serde_json; -use futures; - use juniper::{ execute, parser::{ParseError, ScalarToken, Spanning, Token}, diff --git a/integration_tests/juniper_tests/src/issue_371.rs b/integration_tests/juniper_tests/src/issue_371.rs index 298ee1e9..77184380 100644 --- a/integration_tests/juniper_tests/src/issue_371.rs +++ b/integration_tests/juniper_tests/src/issue_371.rs @@ -1,8 +1,6 @@ // Original author of this test is <https://github.com/davidpdrsn>. use juniper::*; -use futures; - pub struct Context; impl juniper::Context for Context {} diff --git a/integration_tests/juniper_tests/src/issue_398.rs b/integration_tests/juniper_tests/src/issue_398.rs index bb629949..124e1bef 100644 --- a/integration_tests/juniper_tests/src/issue_398.rs +++ b/integration_tests/juniper_tests/src/issue_398.rs @@ -1,8 +1,6 @@ // Original author of this test is <https://github.com/davidpdrsn>. use juniper::*; -use futures; - struct Query; #[juniper::graphql_object] diff --git a/juniper/benches/bench.rs b/juniper/benches/bench.rs index 4999aa5c..b5360f98 100644 --- a/juniper/benches/bench.rs +++ b/juniper/benches/bench.rs @@ -4,11 +4,23 @@ extern crate juniper; use bencher::Bencher; -use juniper::{execute_sync, tests::model::Database, EmptyMutation, RootNode, Variables}; +use juniper::{ + execute_sync, tests::model::Database, DefaultScalarValue, EmptyMutation, EmptySubscription, + RootNode, Variables, +}; fn query_type_name(b: &mut Bencher) { let database = Database::new(); - let schema = RootNode::new(&database, EmptyMutation::<Database>::new()); + let schema: RootNode< + &Database, + EmptyMutation<Database>, + EmptySubscription<Database>, + DefaultScalarValue, + > = RootNode::new( + &database, + EmptyMutation::<Database>::new(), + EmptySubscription::<Database>::new(), + ); let doc = r#" query IntrospectionQueryTypeQuery { @@ -24,7 +36,16 @@ fn query_type_name(b: &mut Bencher) { fn introspection_query(b: &mut Bencher) { let database = Database::new(); - let schema = RootNode::new(&database, EmptyMutation::<Database>::new()); + let schema: RootNode< + &Database, + EmptyMutation<Database>, + EmptySubscription<Database>, + DefaultScalarValue, + > = RootNode::new( + &database, + EmptyMutation::<Database>::new(), + EmptySubscription::<Database>::new(), + ); let doc = r#" query IntrospectionQuery { diff --git a/juniper/src/executor_tests/async_await/mod.rs b/juniper/src/executor_tests/async_await/mod.rs index aa352321..380a0783 100644 --- a/juniper/src/executor_tests/async_await/mod.rs +++ b/juniper/src/executor_tests/async_await/mod.rs @@ -8,6 +8,7 @@ enum UserKind { } struct User { + #[allow(dead_code)] id: i32, name: String, kind: UserKind, @@ -24,14 +25,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 { diff --git a/juniper/src/integrations/chrono.rs b/juniper/src/integrations/chrono.rs index 5be416be..d26c9469 100644 --- a/juniper/src/integrations/chrono.rs +++ b/juniper/src/integrations/chrono.rs @@ -13,6 +13,7 @@ | | | resolution. | */ +#![allow(clippy::needless_lifetimes)] use chrono::prelude::*; use crate::{ @@ -255,7 +256,7 @@ mod integration_test { Value::object( vec![ ("exampleNaiveDate", Value::scalar("2015-03-14")), - ("exampleNaiveDateTime", Value::scalar(1467969011.0)), + ("exampleNaiveDateTime", Value::scalar(1_467_969_011.0)), ( "exampleDateTimeFixedOffset", Value::scalar("1996-12-19T16:39:57-08:00"), diff --git a/juniper/src/integrations/serde.rs b/juniper/src/integrations/serde.rs index 126c9b71..85e1a881 100644 --- a/juniper/src/integrations/serde.rs +++ b/juniper/src/integrations/serde.rs @@ -434,7 +434,7 @@ mod tests { // large value without a decimal part is also float assert_eq!( from_str::<InputValue<DefaultScalarValue>>("123567890123").unwrap(), - InputValue::scalar(123567890123.0) + InputValue::scalar(123_567_890_123.0) ); } diff --git a/juniper/src/macros/tests/args.rs b/juniper/src/macros/tests/args.rs index d7d9ffec..81dcc732 100644 --- a/juniper/src/macros/tests/args.rs +++ b/juniper/src/macros/tests/args.rs @@ -1,3 +1,5 @@ +#![allow(unused)] + use juniper_codegen::GraphQLInputObjectInternal as GraphQLInputObject; use crate::{ diff --git a/juniper/src/macros/tests/field.rs b/juniper/src/macros/tests/field.rs index aed00f61..9e16e799 100644 --- a/juniper/src/macros/tests/field.rs +++ b/juniper/src/macros/tests/field.rs @@ -96,11 +96,11 @@ impl Root { } fn with_return() -> i32 { - return 0; + 0 } fn with_return_field_result() -> FieldResult<i32> { - return Ok(0); + Ok(0) } } diff --git a/juniper/src/parser/mod.rs b/juniper/src/parser/mod.rs index ad34f0bf..f64225c2 100644 --- a/juniper/src/parser/mod.rs +++ b/juniper/src/parser/mod.rs @@ -1,4 +1,5 @@ //! Query parser and language utilities +#![allow(clippy::module_inception)] mod document; mod lexer; diff --git a/juniper/src/schema/mod.rs b/juniper/src/schema/mod.rs index ae361c99..7f1658a9 100644 --- a/juniper/src/schema/mod.rs +++ b/juniper/src/schema/mod.rs @@ -1,3 +1,5 @@ +#![allow(clippy::module_inception)] + pub mod meta; pub mod model; pub mod schema; diff --git a/juniper/src/tests/model.rs b/juniper/src/tests/model.rs index 8731614b..645ede18 100644 --- a/juniper/src/tests/model.rs +++ b/juniper/src/tests/model.rs @@ -106,6 +106,29 @@ pub struct Database { droids: HashMap<String, DroidData>, } +use crate::{ + executor::Registry, schema::meta::MetaType, types::base::GraphQLType, value::ScalarValue, +}; + +impl<S> GraphQLType<S> for Database +where + S: ScalarValue, +{ + type Context = Self; + type TypeInfo = (); + + fn name(_: &()) -> Option<&str> { + Some("_Database") + } + + fn meta<'r>(_: &(), registry: &mut Registry<'r, S>) -> MetaType<'r, S> + where + S: 'r, + { + registry.build_object_type::<Self>(&(), &[]).into_meta() + } +} + impl HumanData { pub fn new( id: &str, diff --git a/juniper_benchmarks/benches/benchmark.rs b/juniper_benchmarks/benches/benchmark.rs index 1f0102b3..eb536dc8 100644 --- a/juniper_benchmarks/benches/benchmark.rs +++ b/juniper_benchmarks/benches/benchmark.rs @@ -1,8 +1,8 @@ extern crate juniper_benchmarks; -use criterion::{black_box, criterion_group, criterion_main, Criterion, ParameterizedBenchmark}; +use criterion::{criterion_group, criterion_main, Criterion, ParameterizedBenchmark}; -use juniper::{graphql_value, InputValue, ToInputValue, Value}; +use juniper::InputValue; use juniper_benchmarks as j; fn bench_sync_vs_async_users_flat_instant(c: &mut Criterion) { diff --git a/juniper_codegen/src/derive_input_object.rs b/juniper_codegen/src/derive_input_object.rs index ed42ae14..26ec19b3 100644 --- a/juniper_codegen/src/derive_input_object.rs +++ b/juniper_codegen/src/derive_input_object.rs @@ -1,3 +1,4 @@ +#![allow(clippy::match_wild_err_arm)] use std::str::FromStr; use proc_macro2::{Span, TokenStream}; diff --git a/juniper_codegen/src/impl_object.rs b/juniper_codegen/src/impl_object.rs index a2f16cb0..4e0a568a 100644 --- a/juniper_codegen/src/impl_object.rs +++ b/juniper_codegen/src/impl_object.rs @@ -1,3 +1,5 @@ +#![allow(clippy::collapsible_if)] + use crate::util; use proc_macro::TokenStream; use quote::quote; diff --git a/juniper_codegen/src/util/mod.rs b/juniper_codegen/src/util/mod.rs index 3b6d6fb9..b9969e20 100644 --- a/juniper_codegen/src/util/mod.rs +++ b/juniper_codegen/src/util/mod.rs @@ -1,3 +1,5 @@ +#![allow(clippy::single_match)] + pub mod parse_impl; use quote::quote; @@ -1264,7 +1266,7 @@ mod test { fn strs_to_strings(source: Vec<&str>) -> Vec<String> { source .iter() - .map(|x| x.to_string()) + .map(|x| (*x).to_string()) .collect::<Vec<String>>() } @@ -1281,7 +1283,7 @@ mod test { #[test] fn test_single() { - let result = get_doc_strings(&vec![MetaNameValue { + let result = get_doc_strings(&[MetaNameValue { path: ident("doc").into(), eq_token: Default::default(), lit: litstr("foo"), @@ -1294,7 +1296,7 @@ mod test { #[test] fn test_many() { - let result = get_doc_strings(&vec![ + let result = get_doc_strings(&[ MetaNameValue { path: ident("doc").into(), eq_token: Default::default(), @@ -1319,7 +1321,7 @@ mod test { #[test] fn test_not_doc() { - let result = get_doc_strings(&vec![MetaNameValue { + let result = get_doc_strings(&[MetaNameValue { path: ident("blah").into(), eq_token: Default::default(), lit: litstr("foo"), diff --git a/juniper_codegen/src/util/parse_impl.rs b/juniper_codegen/src/util/parse_impl.rs index 85e8e9d7..69691e01 100644 --- a/juniper_codegen/src/util/parse_impl.rs +++ b/juniper_codegen/src/util/parse_impl.rs @@ -1,4 +1,5 @@ //! Parse impl blocks. +#![allow(clippy::or_fun_call)] use proc_macro::TokenStream; use quote::quote; diff --git a/juniper_hyper/src/lib.rs b/juniper_hyper/src/lib.rs index 64241ac8..5e1adcd6 100644 --- a/juniper_hyper/src/lib.rs +++ b/juniper_hyper/src/lib.rs @@ -15,8 +15,8 @@ use serde_json::error::Error as SerdeError; use std::{error::Error, fmt, string::FromUtf8Error, sync::Arc}; use url::form_urlencoded; -pub async fn graphql<CtxT, QueryT, MutationT, SubscrtipionT, S>( - root_node: Arc<RootNode<'static, QueryT, MutationT, SubscrtipionT, S>>, +pub async fn graphql<CtxT, QueryT, MutationT, SubscriptionT, S>( + root_node: Arc<RootNode<'static, QueryT, MutationT, SubscriptionT, S>>, context: Arc<CtxT>, request: Request<Body>, ) -> Result<Response<Body>, hyper::Error> @@ -25,10 +25,10 @@ where CtxT: Send + Sync + 'static, QueryT: GraphQLType<S, Context = CtxT> + Send + Sync + 'static, MutationT: GraphQLType<S, Context = CtxT> + Send + Sync + 'static, - SubscrtipionT: GraphQLType<S, Context = CtxT> + Send + Sync + 'static, + SubscriptionT: GraphQLType<S, Context = CtxT> + Send + Sync + 'static, QueryT::TypeInfo: Send + Sync, MutationT::TypeInfo: Send + Sync, - SubscrtipionT::TypeInfo: Send + Sync, + SubscriptionT::TypeInfo: Send + Sync, { match *request.method() { Method::GET => { @@ -61,7 +61,7 @@ where CtxT: Send + Sync + 'static, QueryT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync + 'static, MutationT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync + 'static, - SubscriptionT: GraphQLType<S, Context = CtxT> + Send + Sync + 'static, + SubscriptionT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync + 'static, QueryT::TypeInfo: Send + Sync, MutationT::TypeInfo: Send + Sync, SubscriptionT::TypeInfo: Send + Sync, @@ -120,11 +120,14 @@ pub async fn graphiql(graphql_endpoint: &str) -> Result<Response<Body>, hyper::E Ok(resp) } -pub async fn playground(graphql_endpoint: &str) -> Result<Response<Body>, hyper::Error> { +pub async fn playground( + graphql_endpoint: &str, + subscriptions_endpoint: Option<&str>, +) -> Result<Response<Body>, hyper::Error> { let mut resp = new_html_response(StatusCode::OK); *resp.body_mut() = Body::from(juniper::http::playground::playground_source( graphql_endpoint, - None, + subscriptions_endpoint, )); Ok(resp) } @@ -176,7 +179,7 @@ where CtxT: Send + Sync + 'static, QueryT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync + 'static, MutationT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync + 'static, - SubscriptionT: GraphQLType<S, Context = CtxT> + Send + Sync + 'static, + SubscriptionT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync + 'static, QueryT::TypeInfo: Send + Sync, MutationT::TypeInfo: Send + Sync, SubscriptionT::TypeInfo: Send + Sync, @@ -322,7 +325,7 @@ where S: Send + Sync, QueryT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync, MutationT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync, - SubscriptionT: GraphQLType<S, Context = CtxT> + Send + Sync, + SubscriptionT: GraphQLTypeAsync<S, Context = CtxT> + Send + Sync, QueryT::TypeInfo: Send + Sync, MutationT::TypeInfo: Send + Sync, SubscriptionT::TypeInfo: Send + Sync, @@ -330,7 +333,7 @@ where { match self { GraphQLRequest::Single(request) => { - let res = request.execute(&root_node, &context).await; + let res = request.execute(&*root_node, &context).await; let is_ok = res.is_ok(); let body = Body::from(serde_json::to_string_pretty(&res).unwrap()); (is_ok, body) @@ -338,7 +341,7 @@ where GraphQLRequest::Batch(requests) => { let futures = requests .iter() - .map(|request| request.execute(&root_node, &context)) + .map(|request| request.execute(&*root_node, &context)) .collect::<Vec<_>>(); let results = futures::future::join_all(futures).await; @@ -389,7 +392,6 @@ impl Error for GraphQLRequestError { #[cfg(test)] mod tests { - use futures; use hyper::{ service::{make_service_fn, service_fn}, Body, Method, Response, Server, StatusCode, diff --git a/juniper_iron/src/lib.rs b/juniper_iron/src/lib.rs index 9aea2b93..3d0eff38 100644 --- a/juniper_iron/src/lib.rs +++ b/juniper_iron/src/lib.rs @@ -226,6 +226,7 @@ pub struct GraphiQLHandler { /// Handler that renders `GraphQL Playground` - a graphical query editor interface pub struct PlaygroundHandler { graphql_url: String, + subscription_url: Option<String>, } fn get_single_value<T>(mut values: Vec<T>) -> IronResult<T> { @@ -262,9 +263,9 @@ where impl<'a, CtxFactory, Query, Mutation, Subscription, CtxT, S> GraphQLHandler<'a, CtxFactory, Query, Mutation, Subscription, CtxT, S> where - S: ScalarValue + 'a, + S: ScalarValue + Send + Sync + 'static, CtxFactory: Fn(&mut Request) -> IronResult<CtxT> + Send + Sync + 'static, - CtxT: 'static, + CtxT: Send + Sync + 'static, Query: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static, Mutation: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static, Subscription: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static, @@ -348,9 +349,10 @@ impl PlaygroundHandler { /// /// The provided URL should point to the URL of the attached `GraphQLHandler`. It can be /// relative, so a common value could be `"/graphql"`. - pub fn new(graphql_url: &str) -> PlaygroundHandler { + pub fn new(graphql_url: &str, subscription_url: Option<&str>) -> PlaygroundHandler { PlaygroundHandler { graphql_url: graphql_url.to_owned(), + subscription_url: subscription_url.map(|s| s.to_owned()), } } } @@ -360,7 +362,7 @@ impl<'a, CtxFactory, Query, Mutation, Subscription, CtxT, S> Handler where S: ScalarValue + Sync + Send + 'static, CtxFactory: Fn(&mut Request) -> IronResult<CtxT> + Send + Sync + 'static, - CtxT: 'static, + CtxT: Send + Sync + 'static, Query: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static, Mutation: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static, Subscription: GraphQLType<S, Context = CtxT, TypeInfo = ()> + Send + Sync + 'static, @@ -398,7 +400,10 @@ impl Handler for PlaygroundHandler { Ok(Response::with(( content_type, status::Ok, - juniper::http::playground::playground_source(&self.graphql_url, None), + juniper::http::playground::playground_source( + &self.graphql_url, + self.subscription_url.as_deref(), + ), ))) } } @@ -462,7 +467,7 @@ mod tests { let path: String = url .path() .iter() - .map(|x| x.to_string()) + .map(|x| (*x).to_string()) .collect::<Vec<String>>() .join("/"); format!( diff --git a/juniper_rocket/src/lib.rs b/juniper_rocket/src/lib.rs index 93cffe28..7b2b82ba 100644 --- a/juniper_rocket/src/lib.rs +++ b/juniper_rocket/src/lib.rs @@ -148,10 +148,13 @@ pub fn graphiql_source(graphql_endpoint_url: &str) -> content::Html<String> { } /// Generate an HTML page containing GraphQL Playground -pub fn playground_source(graphql_endpoint_url: &str) -> content::Html<String> { +pub fn playground_source( + graphql_endpoint_url: &str, + subscriptions_endpoint: Option<&str>, +) -> content::Html<String> { content::Html(juniper::http::playground::playground_source( graphql_endpoint_url, - None, + subscriptions_endpoint, )) } diff --git a/juniper_subscriptions/src/lib.rs b/juniper_subscriptions/src/lib.rs index a582b8b4..111404d9 100644 --- a/juniper_subscriptions/src/lib.rs +++ b/juniper_subscriptions/src/lib.rs @@ -240,12 +240,12 @@ where } }); let obj = Object::from_iter(ready_vec_iterator); - return Poll::Ready(Some(GraphQLResponse::from_result(Ok(( + Poll::Ready(Some(GraphQLResponse::from_result(Ok(( Value::Object(obj), vec![], - ))))); + ))))) } else { - return Poll::Pending; + Poll::Pending } }, ); diff --git a/juniper_warp/src/lib.rs b/juniper_warp/src/lib.rs index 769062c4..558d90ae 100644 --- a/juniper_warp/src/lib.rs +++ b/juniper_warp/src/lib.rs @@ -75,11 +75,11 @@ where SubscriptionT::TypeInfo: Send + Sync, CtxT: Send + Sync, { - match self { - &GraphQLBatchRequest::Single(ref request) => { + match *self { + GraphQLBatchRequest::Single(ref request) => { GraphQLBatchResponse::Single(request.execute_sync(root_node, context)) } - &GraphQLBatchRequest::Batch(ref requests) => GraphQLBatchResponse::Batch( + GraphQLBatchRequest::Batch(ref requests) => GraphQLBatchResponse::Batch( requests .iter() .map(|request| request.execute_sync(root_node, context)) @@ -103,12 +103,12 @@ where CtxT: Send + Sync, S: Send + Sync, { - match self { - &GraphQLBatchRequest::Single(ref request) => { + match *self { + GraphQLBatchRequest::Single(ref request) => { let res = request.execute(root_node, context).await; GraphQLBatchResponse::Single(res) } - &GraphQLBatchRequest::Batch(ref requests) => { + GraphQLBatchRequest::Batch(ref requests) => { let futures = requests .iter() .map(|request| request.execute(root_node, context)) @@ -265,7 +265,7 @@ where }; let get_filter = warp::get() - .and(context_extractor.clone()) + .and(context_extractor) .and(warp::filters::query::query()) .and_then(handle_get_request); @@ -731,7 +731,7 @@ mod tests { EmptySubscription::<Database>::new(), ); - let state = warp::any().map(move || Database::new()); + let state = warp::any().map(Database::new); let filter = warp::path("graphql2").and(make_graphql_filter(schema, state.boxed())); let response = request() @@ -770,7 +770,7 @@ mod tests { EmptySubscription::<Database>::new(), ); - let state = warp::any().map(move || Database::new()); + let state = warp::any().map(Database::new); let filter = warp::path("graphql2").and(make_graphql_filter(schema, state.boxed())); let response = request()