diff --git a/juniper/src/lib.rs b/juniper/src/lib.rs index d4253f02..ca0a4dc5 100644 --- a/juniper/src/lib.rs +++ b/juniper/src/lib.rs @@ -181,7 +181,7 @@ pub use crate::{ pub type BoxFuture<'a, T> = std::pin::Pin + 'a + Send>>; #[cfg(feature = "async")] -pub use crate::types::async_await::{GraphQLTypeAsync}; +pub use crate::types::async_await::GraphQLTypeAsync; /// An error that prevented query execution #[derive(Debug, PartialEq)] diff --git a/juniper/src/macros/scalar.rs b/juniper/src/macros/scalar.rs index 50753f3b..4f3ae84e 100644 --- a/juniper/src/macros/scalar.rs +++ b/juniper/src/macros/scalar.rs @@ -432,7 +432,7 @@ macro_rules! graphql_scalar { use $crate::GraphQLType; use futures::future; let v = self.resolve(info, selection_set, executor); - future::FutureExt::boxed(future::ready(v)) + Box::pin(future::ready(v)) } } ); diff --git a/juniper/src/schema/schema.rs b/juniper/src/schema/schema.rs index a860ec72..5d0b0274 100644 --- a/juniper/src/schema/schema.rs +++ b/juniper/src/schema/schema.rs @@ -99,7 +99,7 @@ where match field_name { "__schema" | "__type" => { let v = self.resolve_field(info, field_name, arguments, executor); - ready(v).boxed() + Box::pin(ready(v)) } _ => self .query_type diff --git a/juniper/src/types/async_await.rs b/juniper/src/types/async_await.rs index 4297c630..ab7b95d4 100644 --- a/juniper/src/types/async_await.rs +++ b/juniper/src/types/async_await.rs @@ -1,9 +1,12 @@ +use crate::{ + ast::{Directive, FromInputValue, InputValue, Selection}, + value::{Object, ScalarRefValue, ScalarValue, Value}, +}; -use crate::ast::{Directive, FromInputValue, InputValue, Selection}; -use crate::value::{Object, ScalarRefValue, ScalarValue, Value}; - -use crate::executor::{ExecutionResult, Executor}; -use crate::parser::Spanning; +use crate::{ + executor::{ExecutionResult, Executor}, + parser::Spanning, +}; use crate::BoxFuture; @@ -57,9 +60,12 @@ where 'e: 'a, for<'b> &'b S: ScalarRefValue<'b>, { - use futures::future::FutureExt; - - resolve_selection_set_into_async_recursive(instance, info, selection_set, executor).boxed() + Box::pin(resolve_selection_set_into_async_recursive( + instance, + info, + selection_set, + executor, + )) } struct AsyncField { @@ -86,10 +92,7 @@ where CtxT: Send + Sync, for<'b> &'b S: ScalarRefValue<'b>, { - use futures::{ - future::FutureExt, - stream::{FuturesOrdered, StreamExt}, - }; + use futures::stream::{FuturesOrdered, StreamExt}; let mut object = Object::with_capacity(selection_set.len()); @@ -180,7 +183,7 @@ where value, }) }; - async_values.push(field_future.boxed()); + async_values.push(Box::pin(field_future)); } Selection::FragmentSpread(Spanning { item: ref spread, .. @@ -203,7 +206,7 @@ where .await; AsyncValue::Nested(value) }; - async_values.push(f.boxed()); + async_values.push(Box::pin(f)); } Selection::InlineFragment(Spanning { item: ref fragment, @@ -247,7 +250,7 @@ where .await; AsyncValue::Nested(value) }; - async_values.push(f.boxed()); + async_values.push(Box::pin(f)); } } } diff --git a/juniper/src/types/containers.rs b/juniper/src/types/containers.rs index 8004dbaf..06634072 100644 --- a/juniper/src/types/containers.rs +++ b/juniper/src/types/containers.rs @@ -272,7 +272,7 @@ where executor: &'a Executor, ) -> crate::BoxFuture<'a, Value> { let f = resolve_into_list_async(executor, info, self.iter()); - futures::future::FutureExt::boxed(f) + Box::pin(f) } } @@ -292,7 +292,7 @@ where executor: &'a Executor, ) -> crate::BoxFuture<'a, Value> { let f = resolve_into_list_async(executor, info, self.iter()); - futures::future::FutureExt::boxed(f) + Box::pin(f) } } @@ -317,6 +317,6 @@ where None => Value::null(), } }; - futures::future::FutureExt::boxed(f) + Box::pin(f) } } diff --git a/juniper_rocket/src/lib.rs b/juniper_rocket/src/lib.rs index 891a3723..88cf619d 100644 --- a/juniper_rocket/src/lib.rs +++ b/juniper_rocket/src/lib.rs @@ -42,14 +42,14 @@ Check the LICENSE file for details. use std::{ error::Error, - io::Cursor, + io::{Cursor, Read}, }; use rocket::{ - data::{FromDataFuture, FromDataSimple}, + data::{FromDataSimple, Outcome as FromDataOutcome}, http::{ContentType, RawStr, Status}, request::{FormItems, FromForm, FromFormValue}, - response::{content, Responder, Response, ResultFuture}, + response::{content, Responder, Response}, Data, Outcome::{Failure, Forward, Success}, Request,