diff --git a/juniper/src/ast.rs b/juniper/src/ast.rs index 3a3c4de3..2a0d238a 100644 --- a/juniper/src/ast.rs +++ b/juniper/src/ast.rs @@ -194,7 +194,7 @@ pub trait ToInputValue: Sized { fn to_input_value(&self) -> InputValue; } -impl<'a> Type<'a> { +impl Type<'_> { /// Get the name of a named type. /// /// Only applies to named types; lists will return `None`. @@ -221,7 +221,7 @@ impl<'a> Type<'a> { } } -impl<'a> fmt::Display for Type<'a> { +impl fmt::Display for Type<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::Named(n) => write!(f, "{n}"), diff --git a/juniper/src/executor/look_ahead.rs b/juniper/src/executor/look_ahead.rs index bc25c3c1..cd92ed78 100644 --- a/juniper/src/executor/look_ahead.rs +++ b/juniper/src/executor/look_ahead.rs @@ -93,17 +93,17 @@ pub struct LookAheadList<'a, S> { } // Implemented manually to omit redundant `S: Clone` trait bound, imposed by `#[derive(Clone)]`. -impl<'a, S> Clone for LookAheadList<'a, S> { +impl Clone for LookAheadList<'_, S> { fn clone(&self) -> Self { *self } } // Implemented manually to omit redundant `S: Copy` trait bound, imposed by `#[derive(Copy)]`. -impl<'a, S> Copy for LookAheadList<'a, S> {} +impl Copy for LookAheadList<'_, S> {} // Implemented manually to omit redundant `S: Default` trait bound, imposed by `#[derive(Default)]`. -impl<'a, S> Default for LookAheadList<'a, S> { +impl Default for LookAheadList<'_, S> { fn default() -> Self { Self { input_list: &[], @@ -114,13 +114,13 @@ impl<'a, S> Default for LookAheadList<'a, S> { // Implemented manually to omit redundant `S: PartialEq` trait bound, imposed by // `#[derive(PartialEq)]`. -impl<'a, S: ScalarValue> PartialEq for LookAheadList<'a, S> { +impl PartialEq for LookAheadList<'_, S> { fn eq(&self, other: &Self) -> bool { self.iter().eq(other.iter()) } } -impl<'a, S: ScalarValue> LookAheadList<'a, S> { +impl LookAheadList<'_, S> { /// Returns an [`Iterator`] over the items of this [list]. /// /// [list]: https://spec.graphql.org/October2021#sec-List @@ -179,7 +179,7 @@ pub mod look_ahead_list { } } - impl<'a, S: ScalarValue> DoubleEndedIterator for Iter<'a, S> { + impl DoubleEndedIterator for Iter<'_, S> { fn next_back(&mut self) -> Option { let vars = self.vars; self.slice_iter @@ -203,16 +203,16 @@ pub struct LookAheadObject<'a, S> { } // Implemented manually to omit redundant `S: Clone` trait bound, imposed by `#[derive(Clone)]`. -impl<'a, S> Clone for LookAheadObject<'a, S> { +impl Clone for LookAheadObject<'_, S> { fn clone(&self) -> Self { *self } } // Implemented manually to omit redundant `S: Copy` trait bound, imposed by `#[derive(Copy)]`. -impl<'a, S> Copy for LookAheadObject<'a, S> {} +impl Copy for LookAheadObject<'_, S> {} -impl<'a, S> Default for LookAheadObject<'a, S> { +impl Default for LookAheadObject<'_, S> { fn default() -> Self { Self { input_object: &[], @@ -221,13 +221,13 @@ impl<'a, S> Default for LookAheadObject<'a, S> { } } -impl<'a, S: ScalarValue> PartialEq for LookAheadObject<'a, S> { +impl PartialEq for LookAheadObject<'_, S> { fn eq(&self, other: &Self) -> bool { self.iter().eq(other.iter()) } } -impl<'a, S: ScalarValue> LookAheadObject<'a, S> { +impl LookAheadObject<'_, S> { /// Returns an [`Iterator`] over this [input object]'s fields. /// /// [input object]: https://spec.graphql.org/October2021#sec-Input-Objects @@ -301,7 +301,7 @@ pub mod look_ahead_object { } } - impl<'a, S: ScalarValue> DoubleEndedIterator for Iter<'a, S> { + impl DoubleEndedIterator for Iter<'_, S> { fn next_back(&mut self) -> Option { let vars = self.vars; self.slice_iter.next_back().map(move |(key, val)| { @@ -331,14 +331,14 @@ pub struct LookAheadArgument<'a, S> { } // Implemented manually to omit redundant `S: Clone` trait bound, imposed by `#[derive(Clone)]`. -impl<'a, S> Clone for LookAheadArgument<'a, S> { +impl Clone for LookAheadArgument<'_, S> { fn clone(&self) -> Self { *self } } // Implemented manually to omit redundant `S: Copy` trait bound, imposed by `#[derive(Copy)]`. -impl<'a, S> Copy for LookAheadArgument<'a, S> {} +impl Copy for LookAheadArgument<'_, S> {} impl<'a, S> LookAheadArgument<'a, S> { /// Returns the name of this [argument]. @@ -386,7 +386,7 @@ pub struct LookAheadChildren<'a, S> { } // Implemented manually to omit redundant `S: Clone` trait bound, imposed by `#[derive(Clone)]`. -impl<'a, S> Clone for LookAheadChildren<'a, S> { +impl Clone for LookAheadChildren<'_, S> { fn clone(&self) -> Self { Self { children: self.children.clone(), @@ -395,7 +395,7 @@ impl<'a, S> Clone for LookAheadChildren<'a, S> { } // Implemented manually to omit redundant `S: Default` trait bound, imposed by `#[derive(Default)]`. -impl<'a, S> Default for LookAheadChildren<'a, S> { +impl Default for LookAheadChildren<'_, S> { fn default() -> Self { Self { children: vec![] } } @@ -472,14 +472,14 @@ pub(super) enum SelectionSource<'a, S> { } // Implemented manually to omit redundant `S: Clone` trait bound, imposed by `#[derive(Clone)]`. -impl<'a, S> Clone for SelectionSource<'a, S> { +impl Clone for SelectionSource<'_, S> { fn clone(&self) -> Self { *self } } // Implemented manually to omit redundant `S: Copy` trait bound, imposed by `#[derive(Copy)]`. -impl<'a, S> Copy for SelectionSource<'a, S> {} +impl Copy for SelectionSource<'_, S> {} /// [Selection] of an executed GraphQL query, used in [look-ahead][0] operations. /// @@ -496,14 +496,14 @@ pub struct LookAheadSelection<'a, S> { } // Implemented manually to omit redundant `S: Clone` trait bound, imposed by `#[derive(Clone)]`. -impl<'a, S> Clone for LookAheadSelection<'a, S> { +impl Clone for LookAheadSelection<'_, S> { fn clone(&self) -> Self { *self } } // Implemented manually to omit redundant `S: Copy` trait bound, imposed by `#[derive(Copy)]`. -impl<'a, S> Copy for LookAheadSelection<'a, S> {} +impl Copy for LookAheadSelection<'_, S> {} impl<'a, S> LookAheadSelection<'a, S> { /// Constructs a new [`LookAheadSelection`] out of the provided params. @@ -670,7 +670,7 @@ struct ChildrenBuilder<'a, 'f, S> { output: Vec>, } -impl<'a, 'f, S: ScalarValue> ChildrenBuilder<'a, 'f, S> { +impl<'a, S: ScalarValue> ChildrenBuilder<'a, '_, S> { fn visit_parent_selection( &mut self, selection: &'a Selection<'a, S>, diff --git a/juniper/src/executor/mod.rs b/juniper/src/executor/mod.rs index d091bbf8..0e85a41c 100644 --- a/juniper/src/executor/mod.rs +++ b/juniper/src/executor/mod.rs @@ -273,7 +273,7 @@ impl IntoFieldError for std::convert::Infallible { } } -impl<'a, S> IntoFieldError for &'a str { +impl IntoFieldError for &str { fn into_field_error(self) -> FieldError { FieldError::::from(self) } @@ -285,7 +285,7 @@ impl IntoFieldError for String { } } -impl<'a, S> IntoFieldError for Cow<'a, str> { +impl IntoFieldError for Cow<'_, str> { fn into_field_error(self) -> FieldError { FieldError::::from(self) } @@ -403,7 +403,7 @@ pub trait FromContext { /// Marker trait for types that can act as context objects for `GraphQL` types. pub trait Context {} -impl<'a, C: Context> Context for &'a C {} +impl Context for &C {} static NULL_CONTEXT: () = (); @@ -755,7 +755,7 @@ where } } -impl<'a> FieldPath<'a> { +impl FieldPath<'_> { fn construct_path(&self, acc: &mut Vec) { match self { FieldPath::Root(_) => (), diff --git a/juniper/src/executor/owned_executor.rs b/juniper/src/executor/owned_executor.rs index cce1a208..64105823 100644 --- a/juniper/src/executor/owned_executor.rs +++ b/juniper/src/executor/owned_executor.rs @@ -25,7 +25,7 @@ pub struct OwnedExecutor<'a, CtxT, S> { pub(super) field_path: Arc>, } -impl<'a, CtxT, S> Clone for OwnedExecutor<'a, CtxT, S> +impl Clone for OwnedExecutor<'_, CtxT, S> where S: Clone, { diff --git a/juniper/src/integrations/serde.rs b/juniper/src/integrations/serde.rs index 5080cffd..f77202f0 100644 --- a/juniper/src/integrations/serde.rs +++ b/juniper/src/integrations/serde.rs @@ -289,7 +289,7 @@ impl<'de> Deserialize<'de> for DefaultScalarValue { fn deserialize>(de: D) -> Result { struct Visitor; - impl<'de> de::Visitor<'de> for Visitor { + impl de::Visitor<'_> for Visitor { type Value = DefaultScalarValue; fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/juniper/src/macros/reflect.rs b/juniper/src/macros/reflect.rs index 642ccf4a..980d57ab 100644 --- a/juniper/src/macros/reflect.rs +++ b/juniper/src/macros/reflect.rs @@ -44,11 +44,11 @@ pub trait BaseType { const NAME: Type; } -impl<'a, S, T: BaseType + ?Sized> BaseType for &'a T { +impl + ?Sized> BaseType for &T { const NAME: Type = T::NAME; } -impl<'ctx, S, T> BaseType for (&'ctx T::Context, T) +impl BaseType for (&T::Context, T) where S: ScalarValue, T: BaseType + GraphQLValue, @@ -105,11 +105,11 @@ pub trait BaseSubTypes { const NAMES: Types; } -impl<'a, S, T: BaseSubTypes + ?Sized> BaseSubTypes for &'a T { +impl + ?Sized> BaseSubTypes for &T { const NAMES: Types = T::NAMES; } -impl<'ctx, S, T> BaseSubTypes for (&'ctx T::Context, T) +impl BaseSubTypes for (&T::Context, T) where S: ScalarValue, T: BaseSubTypes + GraphQLValue, @@ -205,7 +205,7 @@ pub trait WrappedType { const VALUE: WrappedValue; } -impl<'ctx, S, T: WrappedType> WrappedType for (&'ctx T::Context, T) +impl> WrappedType for (&T::Context, T) where S: ScalarValue, T: GraphQLValue, @@ -237,7 +237,7 @@ impl, const N: usize> WrappedType for [T; N] { const VALUE: u128 = T::VALUE * 10 + 3; } -impl<'a, S, T: WrappedType + ?Sized> WrappedType for &'a T { +impl + ?Sized> WrappedType for &T { const VALUE: u128 = T::VALUE; } diff --git a/juniper/src/parser/lexer.rs b/juniper/src/parser/lexer.rs index a8b0cfa8..5dce84da 100644 --- a/juniper/src/parser/lexer.rs +++ b/juniper/src/parser/lexer.rs @@ -477,7 +477,7 @@ impl<'a> Iterator for Lexer<'a> { } } -impl<'a> fmt::Display for Token<'a> { +impl fmt::Display for Token<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Token::Name(name) => write!(f, "{name}"), diff --git a/juniper/src/schema/meta.rs b/juniper/src/schema/meta.rs index f7673cd9..d41a581a 100644 --- a/juniper/src/schema/meta.rs +++ b/juniper/src/schema/meta.rs @@ -181,7 +181,7 @@ pub struct Field<'a, S> { pub deprecation_status: DeprecationStatus, } -impl<'a, S> Field<'a, S> { +impl Field<'_, S> { /// Returns true if the type is built-in to GraphQL. pub fn is_builtin(&self) -> bool { // "used exclusively by GraphQL’s introspection system" @@ -202,7 +202,7 @@ pub struct Argument<'a, S> { pub default_value: Option>, } -impl<'a, S> Argument<'a, S> { +impl Argument<'_, S> { /// Returns true if the type is built-in to GraphQL. pub fn is_builtin(&self) -> bool { // "used exclusively by GraphQL’s introspection system" @@ -770,7 +770,7 @@ impl EnumValue { } } -impl<'a, S: fmt::Debug> fmt::Debug for ScalarMeta<'a, S> { +impl fmt::Debug for ScalarMeta<'_, S> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("ScalarMeta") .field("name", &self.name) @@ -779,7 +779,7 @@ impl<'a, S: fmt::Debug> fmt::Debug for ScalarMeta<'a, S> { } } -impl<'a, S: fmt::Debug> fmt::Debug for EnumMeta<'a, S> { +impl fmt::Debug for EnumMeta<'_, S> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("EnumMeta") .field("name", &self.name) @@ -789,7 +789,7 @@ impl<'a, S: fmt::Debug> fmt::Debug for EnumMeta<'a, S> { } } -impl<'a, S: fmt::Debug> fmt::Debug for InputObjectMeta<'a, S> { +impl fmt::Debug for InputObjectMeta<'_, S> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.debug_struct("InputObjectMeta") .field("name", &self.name) diff --git a/juniper/src/schema/model.rs b/juniper/src/schema/model.rs index 75b216a7..9ee0b0cf 100644 --- a/juniper/src/schema/model.rs +++ b/juniper/src/schema/model.rs @@ -56,7 +56,7 @@ pub struct SchemaType<'a, S> { directives: FnvHashMap>, } -impl<'a, S> Context for SchemaType<'a, S> {} +impl Context for SchemaType<'_, S> {} #[derive(Clone)] pub enum TypeType<'a, S: 'a> { @@ -96,8 +96,8 @@ pub enum DirectiveLocation { EnumValue, } -impl<'a, QueryT, MutationT, SubscriptionT> - RootNode<'a, QueryT, MutationT, SubscriptionT, DefaultScalarValue> +impl + RootNode<'_, QueryT, MutationT, SubscriptionT, DefaultScalarValue> where QueryT: GraphQLType, MutationT: GraphQLType, @@ -683,7 +683,7 @@ impl fmt::Display for DirectiveLocation { } } -impl<'a, S> fmt::Display for TypeType<'a, S> { +impl fmt::Display for TypeType<'_, S> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Self::Concrete(t) => f.write_str(t.name().unwrap()), diff --git a/juniper/src/schema/schema.rs b/juniper/src/schema/schema.rs index 9ec47e33..fe619dc5 100644 --- a/juniper/src/schema/schema.rs +++ b/juniper/src/schema/schema.rs @@ -17,8 +17,8 @@ use crate::schema::{ model::{DirectiveLocation, DirectiveType, RootNode, SchemaType, TypeType}, }; -impl<'a, S, QueryT, MutationT, SubscriptionT> GraphQLType - for RootNode<'a, QueryT, MutationT, SubscriptionT, S> +impl GraphQLType + for RootNode<'_, QueryT, MutationT, SubscriptionT, S> where S: ScalarValue, QueryT: GraphQLType, @@ -37,8 +37,8 @@ where } } -impl<'a, S, QueryT, MutationT, SubscriptionT> GraphQLValue - for RootNode<'a, QueryT, MutationT, SubscriptionT, S> +impl GraphQLValue + for RootNode<'_, QueryT, MutationT, SubscriptionT, S> where S: ScalarValue, QueryT: GraphQLType, diff --git a/juniper/src/types/containers.rs b/juniper/src/types/containers.rs index 108f0e02..76e5c8f8 100644 --- a/juniper/src/types/containers.rs +++ b/juniper/src/types/containers.rs @@ -277,7 +277,7 @@ where } } -impl<'a, T, S> ToInputValue for &'a [T] +impl ToInputValue for &[T] where T: ToInputValue, S: ScalarValue, diff --git a/juniper/src/types/pointers.rs b/juniper/src/types/pointers.rs index 17e70679..9bf74be3 100644 --- a/juniper/src/types/pointers.rs +++ b/juniper/src/types/pointers.rs @@ -110,7 +110,7 @@ where } } -impl<'e, S, T> GraphQLType for &'e T +impl GraphQLType for &T where T: GraphQLType + ?Sized, S: ScalarValue, @@ -127,7 +127,7 @@ where } } -impl<'e, S, T> GraphQLValue for &'e T +impl GraphQLValue for &T where S: ScalarValue, T: GraphQLValue + ?Sized, @@ -169,7 +169,7 @@ where } } -impl<'e, S, T> GraphQLValueAsync for &'e T +impl GraphQLValueAsync for &T where T: GraphQLValueAsync + ?Sized, T::TypeInfo: Sync, @@ -196,7 +196,7 @@ where } } -impl<'a, T, S> ToInputValue for &'a T +impl ToInputValue for &T where S: fmt::Debug, T: ToInputValue, diff --git a/juniper/src/types/scalars.rs b/juniper/src/types/scalars.rs index 960b3aeb..8faf82a6 100644 --- a/juniper/src/types/scalars.rs +++ b/juniper/src/types/scalars.rs @@ -250,7 +250,7 @@ where } } -impl<'a, S> ToInputValue for &'a str +impl ToInputValue for &str where S: ScalarValue, { diff --git a/juniper/src/validation/input_value.rs b/juniper/src/validation/input_value.rs index 1c906bbb..f4312c82 100644 --- a/juniper/src/validation/input_value.rs +++ b/juniper/src/validation/input_value.rs @@ -360,7 +360,7 @@ fn unification_error( ) } -impl<'a> fmt::Display for Path<'a> { +impl fmt::Display for Path<'_> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { Path::Root => write!(f, ""), diff --git a/juniper/src/validation/multi_visitor.rs b/juniper/src/validation/multi_visitor.rs index f6311668..34163d43 100644 --- a/juniper/src/validation/multi_visitor.rs +++ b/juniper/src/validation/multi_visitor.rs @@ -28,7 +28,7 @@ impl MultiVisitorCons { } } -impl<'a, S> Visitor<'a, S> for MultiVisitorNil where S: ScalarValue {} +impl Visitor<'_, S> for MultiVisitorNil where S: ScalarValue {} impl<'a, A, B, S> Visitor<'a, S> for MultiVisitorCons where diff --git a/juniper_codegen/src/common/parse/mod.rs b/juniper_codegen/src/common/parse/mod.rs index 642a050f..487e0552 100644 --- a/juniper_codegen/src/common/parse/mod.rs +++ b/juniper_codegen/src/common/parse/mod.rs @@ -47,7 +47,7 @@ pub(crate) trait ParseBufferExt { P: Default + Parse + Token; } -impl<'a> ParseBufferExt for ParseBuffer<'a> { +impl ParseBufferExt for ParseBuffer<'_> { fn try_parse(&self) -> syn::Result> { Ok(if self.is_next::() { Some(self.parse()?) @@ -312,7 +312,7 @@ impl GenericsExt for syn::Generics { /// [`Type`]: syn::Type struct ReplaceWithDefaults<'a>(&'a syn::Generics); -impl<'a> VisitMut for ReplaceWithDefaults<'a> { +impl VisitMut for ReplaceWithDefaults<'_> { fn visit_generic_argument_mut(&mut self, arg: &mut syn::GenericArgument) { match arg { syn::GenericArgument::Lifetime(lf) => { diff --git a/juniper_codegen/src/scalar_value/mod.rs b/juniper_codegen/src/scalar_value/mod.rs index f590678c..8bb458a4 100644 --- a/juniper_codegen/src/scalar_value/mod.rs +++ b/juniper_codegen/src/scalar_value/mod.rs @@ -507,7 +507,7 @@ impl<'a> IsVariantGeneric<'a> { } } -impl<'ast, 'gen> Visit<'ast> for IsVariantGeneric<'gen> { +impl<'ast> Visit<'ast> for IsVariantGeneric<'_> { fn visit_path(&mut self, path: &'ast syn::Path) { if let Some(ident) = path.get_ident() { let is_generic = self.generics.params.iter().any(|par| { diff --git a/juniper_rocket/src/lib.rs b/juniper_rocket/src/lib.rs index 934047d1..8fa3e5b7 100644 --- a/juniper_rocket/src/lib.rs +++ b/juniper_rocket/src/lib.rs @@ -254,7 +254,7 @@ pub struct GraphQLContext<'f, S: ScalarValue> { errors: Errors<'f>, } -impl<'f, S: ScalarValue> GraphQLContext<'f, S> { +impl GraphQLContext<'_, S> { fn query(&mut self, value: String) { if self.query.is_some() { let error = Error::from(ErrorKind::Duplicate).with_name("query"); diff --git a/tests/codegen/fail/input-object/derive_incompatible_field_type.stderr b/tests/codegen/fail/input-object/derive_incompatible_field_type.stderr index f5764d81..0edd0d09 100644 --- a/tests/codegen/fail/input-object/derive_incompatible_field_type.stderr +++ b/tests/codegen/fail/input-object/derive_incompatible_field_type.stderr @@ -68,9 +68,9 @@ error[E0277]: the trait bound `ObjectA: ToInputValue<_>` is not satisfied | ^^^^^^^^^^^^^^^^^^ the trait `ToInputValue<_>` is not implemented for `ObjectA` | = help: the following other types implement trait `ToInputValue`: - `&'a T` implements `ToInputValue` - `&'a [T]` implements `ToInputValue` - `&'a str` implements `ToInputValue` + `&T` implements `ToInputValue` + `&[T]` implements `ToInputValue` + `&str` implements `ToInputValue` `Arc` implements `ToInputValue` `Box` implements `ToInputValue` `ID` implements `ToInputValue<__S>` diff --git a/tests/integration/tests/codegen_union_attr.rs b/tests/integration/tests/codegen_union_attr.rs index a10a2435..b8e07208 100644 --- a/tests/integration/tests/codegen_union_attr.rs +++ b/tests/integration/tests/codegen_union_attr.rs @@ -1097,7 +1097,7 @@ mod external_resolver { type DynCharacter<'a> = dyn Character + prelude::Send + prelude::Sync + 'a; - impl<'a> DynCharacter<'a> { + impl DynCharacter<'_> { fn as_droid<'db>(&self, db: &'db Database) -> prelude::Option<&'db Droid> { db.droid.as_ref() } diff --git a/tests/integration/tests/common/mod.rs b/tests/integration/tests/common/mod.rs index aae6a04c..f21a89d7 100644 --- a/tests/integration/tests/common/mod.rs +++ b/tests/integration/tests/common/mod.rs @@ -94,7 +94,7 @@ impl<'de> Deserialize<'de> for MyScalarValue { fn deserialize>(de: D) -> Result { struct Visitor; - impl<'de> de::Visitor<'de> for Visitor { + impl de::Visitor<'_> for Visitor { type Value = MyScalarValue; fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {