From 86b5319315c98d233342eb53334fe8626236933e Mon Sep 17 00:00:00 2001 From: tyranron Date: Tue, 12 Mar 2024 16:53:09 +0200 Subject: [PATCH] Fix unit tests for latest nightly --- juniper/src/parser/lexer.rs | 7 +------ juniper/src/parser/parser.rs | 2 +- juniper/src/schema/meta.rs | 5 +---- juniper/src/types/scalars.rs | 4 +--- juniper/src/types/utilities.rs | 2 +- .../src/graphql_transport_ws/mod.rs | 13 +++++++++---- juniper_graphql_ws/src/graphql_ws/mod.rs | 17 +++++++++++------ juniper_subscriptions/src/lib.rs | 11 ++++++++--- 8 files changed, 33 insertions(+), 28 deletions(-) diff --git a/juniper/src/parser/lexer.rs b/juniper/src/parser/lexer.rs index 4eae6d6b..a8b0cfa8 100644 --- a/juniper/src/parser/lexer.rs +++ b/juniper/src/parser/lexer.rs @@ -1,9 +1,4 @@ -use std::{ - char, fmt, - iter::{Iterator, Peekable}, - result::Result, - str::CharIndices, -}; +use std::{char, fmt, iter::Peekable, str::CharIndices}; use crate::parser::{SourcePosition, Spanning}; diff --git a/juniper/src/parser/parser.rs b/juniper/src/parser/parser.rs index 41922b85..f11facc3 100644 --- a/juniper/src/parser/parser.rs +++ b/juniper/src/parser/parser.rs @@ -1,4 +1,4 @@ -use std::{error::Error, fmt, result::Result}; +use std::{error::Error, fmt}; use smartstring::alias::String; diff --git a/juniper/src/schema/meta.rs b/juniper/src/schema/meta.rs index 04f5eda9..f7673cd9 100644 --- a/juniper/src/schema/meta.rs +++ b/juniper/src/schema/meta.rs @@ -1,10 +1,7 @@ //! Types used to describe a `GraphQL` schema use juniper::IntoFieldError; -use std::{ - borrow::{Cow, ToOwned}, - fmt, -}; +use std::{borrow::Cow, fmt}; use crate::{ ast::{FromInputValue, InputValue, Type}, diff --git a/juniper/src/types/scalars.rs b/juniper/src/types/scalars.rs index c1002ec2..c904fcab 100644 --- a/juniper/src/types/scalars.rs +++ b/juniper/src/types/scalars.rs @@ -1,6 +1,4 @@ -use std::{ - char, convert::From, fmt, marker::PhantomData, ops::Deref, rc::Rc, thread::JoinHandle, u32, -}; +use std::{char, fmt, marker::PhantomData, ops::Deref, rc::Rc, thread::JoinHandle, u32}; use serde::{Deserialize, Serialize}; diff --git a/juniper/src/types/utilities.rs b/juniper/src/types/utilities.rs index a4f5c45b..42106c54 100644 --- a/juniper/src/types/utilities.rs +++ b/juniper/src/types/utilities.rs @@ -1,4 +1,4 @@ -use std::{collections::HashSet, iter::Iterator}; +use std::collections::HashSet; use crate::{ ast::InputValue, diff --git a/juniper_graphql_ws/src/graphql_transport_ws/mod.rs b/juniper_graphql_ws/src/graphql_transport_ws/mod.rs index c08cf021..8553c189 100644 --- a/juniper_graphql_ws/src/graphql_transport_ws/mod.rs +++ b/juniper_graphql_ws/src/graphql_transport_ws/mod.rs @@ -611,16 +611,21 @@ where #[cfg(test)] mod test { - use std::{convert::Infallible, io}; + use std::{convert::Infallible, io, sync::Arc, time::Duration}; use juniper::{ - futures::sink::SinkExt, + futures::{ + future::{self, FutureExt as _}, + sink::SinkExt, + stream::{self, BoxStream, StreamExt as _}, + }, graphql_input_value, graphql_object, graphql_subscription, graphql_value, graphql_vars, parser::{ParseError, Spanning}, - DefaultScalarValue, EmptyMutation, FieldError, FieldResult, RootNode, Variables, + DefaultScalarValue, EmptyMutation, FieldError, FieldResult, GraphQLError, RootNode, + Variables, }; - use super::*; + use super::{Connection, ConnectionConfig, NextPayload, Output, SubscribePayload}; struct Context(i32); diff --git a/juniper_graphql_ws/src/graphql_ws/mod.rs b/juniper_graphql_ws/src/graphql_ws/mod.rs index 2c99a324..87950717 100644 --- a/juniper_graphql_ws/src/graphql_ws/mod.rs +++ b/juniper_graphql_ws/src/graphql_ws/mod.rs @@ -23,8 +23,8 @@ use std::{ use juniper::{ futures::{ channel::oneshot, - future::{self, BoxFuture, Either, Future, FutureExt, TryFutureExt}, - stream::{self, BoxStream, SelectAll, StreamExt}, + future::{self, BoxFuture, Either, Future, FutureExt as _, TryFutureExt as _}, + stream::{self, BoxStream, SelectAll, StreamExt as _}, task::{Context, Poll, Waker}, Sink, Stream, }, @@ -547,16 +547,21 @@ where #[cfg(test)] mod test { - use std::{convert::Infallible, io}; + use std::{convert::Infallible, io, sync::Arc, time::Duration}; use juniper::{ - futures::sink::SinkExt, + futures::{ + future::{self, FutureExt as _}, + sink::SinkExt, + stream::{self, BoxStream, StreamExt as _}, + }, graphql_input_value, graphql_object, graphql_subscription, graphql_value, graphql_vars, parser::{ParseError, Spanning}, - DefaultScalarValue, EmptyMutation, FieldError, FieldResult, RootNode, Variables, + DefaultScalarValue, EmptyMutation, FieldError, FieldResult, GraphQLError, RootNode, + Variables, }; - use super::*; + use super::{Connection, ConnectionConfig, ConnectionErrorPayload, DataPayload, StartPayload}; struct Context(i32); diff --git a/juniper_subscriptions/src/lib.rs b/juniper_subscriptions/src/lib.rs index 3d5d77bb..83d44126 100644 --- a/juniper_subscriptions/src/lib.rs +++ b/juniper_subscriptions/src/lib.rs @@ -242,10 +242,15 @@ where #[cfg(test)] mod whole_responses_stream { - use futures::{stream, StreamExt as _}; - use juniper::{graphql_value, DefaultScalarValue, ExecutionError, FieldError}; + use std::task::Poll; - use super::*; + use futures::{stream, StreamExt as _}; + use juniper::{ + graphql_value, DefaultScalarValue, ExecutionError, ExecutionOutput, FieldError, Object, + Value, ValuesStream, + }; + + use super::whole_responses_stream; #[tokio::test] async fn with_error() {