Tune lints for 1.83 Rust

This commit is contained in:
tyranron 2024-11-29 15:26:08 +01:00
parent b32004f022
commit dc19d85fae
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
21 changed files with 66 additions and 66 deletions

View file

@ -194,7 +194,7 @@ pub trait ToInputValue<S = DefaultScalarValue>: Sized {
fn to_input_value(&self) -> InputValue<S>;
}
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}"),

View file

@ -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<S> 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<S> 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<S> 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<S: ScalarValue> PartialEq for LookAheadList<'_, S> {
fn eq(&self, other: &Self) -> bool {
self.iter().eq(other.iter())
}
}
impl<'a, S: ScalarValue> LookAheadList<'a, S> {
impl<S: ScalarValue> 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<S: ScalarValue> DoubleEndedIterator for Iter<'_, S> {
fn next_back(&mut self) -> Option<Self::Item> {
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<S> 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<S> Copy for LookAheadObject<'_, S> {}
impl<'a, S> Default for LookAheadObject<'a, S> {
impl<S> 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<S: ScalarValue> PartialEq for LookAheadObject<'_, S> {
fn eq(&self, other: &Self) -> bool {
self.iter().eq(other.iter())
}
}
impl<'a, S: ScalarValue> LookAheadObject<'a, S> {
impl<S: ScalarValue> 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<S: ScalarValue> DoubleEndedIterator for Iter<'_, S> {
fn next_back(&mut self) -> Option<Self::Item> {
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<S> 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<S> 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<S> 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<S> 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<S> 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<S> 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<S> 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<S> 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<LookAheadSelection<'a, S>>,
}
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>,

View file

@ -273,7 +273,7 @@ impl<S> IntoFieldError<S> for std::convert::Infallible {
}
}
impl<'a, S> IntoFieldError<S> for &'a str {
impl<S> IntoFieldError<S> for &str {
fn into_field_error(self) -> FieldError<S> {
FieldError::<S>::from(self)
}
@ -285,7 +285,7 @@ impl<S> IntoFieldError<S> for String {
}
}
impl<'a, S> IntoFieldError<S> for Cow<'a, str> {
impl<S> IntoFieldError<S> for Cow<'_, str> {
fn into_field_error(self) -> FieldError<S> {
FieldError::<S>::from(self)
}
@ -403,7 +403,7 @@ pub trait FromContext<T> {
/// 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<C: Context> Context for &C {}
static NULL_CONTEXT: () = ();
@ -755,7 +755,7 @@ where
}
}
impl<'a> FieldPath<'a> {
impl FieldPath<'_> {
fn construct_path(&self, acc: &mut Vec<String>) {
match self {
FieldPath::Root(_) => (),

View file

@ -25,7 +25,7 @@ pub struct OwnedExecutor<'a, CtxT, S> {
pub(super) field_path: Arc<FieldPath<'a>>,
}
impl<'a, CtxT, S> Clone for OwnedExecutor<'a, CtxT, S>
impl<CtxT, S> Clone for OwnedExecutor<'_, CtxT, S>
where
S: Clone,
{

View file

@ -289,7 +289,7 @@ impl<'de> Deserialize<'de> for DefaultScalarValue {
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error> {
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 {

View file

@ -44,11 +44,11 @@ pub trait BaseType<S> {
const NAME: Type;
}
impl<'a, S, T: BaseType<S> + ?Sized> BaseType<S> for &'a T {
impl<S, T: BaseType<S> + ?Sized> BaseType<S> for &T {
const NAME: Type = T::NAME;
}
impl<'ctx, S, T> BaseType<S> for (&'ctx T::Context, T)
impl<S, T> BaseType<S> for (&T::Context, T)
where
S: ScalarValue,
T: BaseType<S> + GraphQLValue<S>,
@ -105,11 +105,11 @@ pub trait BaseSubTypes<S> {
const NAMES: Types;
}
impl<'a, S, T: BaseSubTypes<S> + ?Sized> BaseSubTypes<S> for &'a T {
impl<S, T: BaseSubTypes<S> + ?Sized> BaseSubTypes<S> for &T {
const NAMES: Types = T::NAMES;
}
impl<'ctx, S, T> BaseSubTypes<S> for (&'ctx T::Context, T)
impl<S, T> BaseSubTypes<S> for (&T::Context, T)
where
S: ScalarValue,
T: BaseSubTypes<S> + GraphQLValue<S>,
@ -205,7 +205,7 @@ pub trait WrappedType<S> {
const VALUE: WrappedValue;
}
impl<'ctx, S, T: WrappedType<S>> WrappedType<S> for (&'ctx T::Context, T)
impl<S, T: WrappedType<S>> WrappedType<S> for (&T::Context, T)
where
S: ScalarValue,
T: GraphQLValue<S>,
@ -237,7 +237,7 @@ impl<S, T: WrappedType<S>, const N: usize> WrappedType<S> for [T; N] {
const VALUE: u128 = T::VALUE * 10 + 3;
}
impl<'a, S, T: WrappedType<S> + ?Sized> WrappedType<S> for &'a T {
impl<S, T: WrappedType<S> + ?Sized> WrappedType<S> for &T {
const VALUE: u128 = T::VALUE;
}

View file

@ -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}"),

View file

@ -181,7 +181,7 @@ pub struct Field<'a, S> {
pub deprecation_status: DeprecationStatus,
}
impl<'a, S> Field<'a, S> {
impl<S> Field<'_, S> {
/// Returns true if the type is built-in to GraphQL.
pub fn is_builtin(&self) -> bool {
// "used exclusively by GraphQLs introspection system"
@ -202,7 +202,7 @@ pub struct Argument<'a, S> {
pub default_value: Option<InputValue<S>>,
}
impl<'a, S> Argument<'a, S> {
impl<S> Argument<'_, S> {
/// Returns true if the type is built-in to GraphQL.
pub fn is_builtin(&self) -> bool {
// "used exclusively by GraphQLs introspection system"
@ -770,7 +770,7 @@ impl EnumValue {
}
}
impl<'a, S: fmt::Debug> fmt::Debug for ScalarMeta<'a, S> {
impl<S: fmt::Debug> 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<S: fmt::Debug> 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<S: fmt::Debug> fmt::Debug for InputObjectMeta<'_, S> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("InputObjectMeta")
.field("name", &self.name)

View file

@ -56,7 +56,7 @@ pub struct SchemaType<'a, S> {
directives: FnvHashMap<String, DirectiveType<'a, S>>,
}
impl<'a, S> Context for SchemaType<'a, S> {}
impl<S> 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<QueryT, MutationT, SubscriptionT>
RootNode<'_, QueryT, MutationT, SubscriptionT, DefaultScalarValue>
where
QueryT: GraphQLType<DefaultScalarValue, TypeInfo = ()>,
MutationT: GraphQLType<DefaultScalarValue, TypeInfo = ()>,
@ -683,7 +683,7 @@ impl fmt::Display for DirectiveLocation {
}
}
impl<'a, S> fmt::Display for TypeType<'a, S> {
impl<S> 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()),

View file

@ -17,8 +17,8 @@ use crate::schema::{
model::{DirectiveLocation, DirectiveType, RootNode, SchemaType, TypeType},
};
impl<'a, S, QueryT, MutationT, SubscriptionT> GraphQLType<S>
for RootNode<'a, QueryT, MutationT, SubscriptionT, S>
impl<S, QueryT, MutationT, SubscriptionT> GraphQLType<S>
for RootNode<'_, QueryT, MutationT, SubscriptionT, S>
where
S: ScalarValue,
QueryT: GraphQLType<S>,
@ -37,8 +37,8 @@ where
}
}
impl<'a, S, QueryT, MutationT, SubscriptionT> GraphQLValue<S>
for RootNode<'a, QueryT, MutationT, SubscriptionT, S>
impl<S, QueryT, MutationT, SubscriptionT> GraphQLValue<S>
for RootNode<'_, QueryT, MutationT, SubscriptionT, S>
where
S: ScalarValue,
QueryT: GraphQLType<S>,

View file

@ -277,7 +277,7 @@ where
}
}
impl<'a, T, S> ToInputValue<S> for &'a [T]
impl<T, S> ToInputValue<S> for &[T]
where
T: ToInputValue<S>,
S: ScalarValue,

View file

@ -110,7 +110,7 @@ where
}
}
impl<'e, S, T> GraphQLType<S> for &'e T
impl<S, T> GraphQLType<S> for &T
where
T: GraphQLType<S> + ?Sized,
S: ScalarValue,
@ -127,7 +127,7 @@ where
}
}
impl<'e, S, T> GraphQLValue<S> for &'e T
impl<S, T> GraphQLValue<S> for &T
where
S: ScalarValue,
T: GraphQLValue<S> + ?Sized,
@ -169,7 +169,7 @@ where
}
}
impl<'e, S, T> GraphQLValueAsync<S> for &'e T
impl<S, T> GraphQLValueAsync<S> for &T
where
T: GraphQLValueAsync<S> + ?Sized,
T::TypeInfo: Sync,
@ -196,7 +196,7 @@ where
}
}
impl<'a, T, S> ToInputValue<S> for &'a T
impl<T, S> ToInputValue<S> for &T
where
S: fmt::Debug,
T: ToInputValue<S>,

View file

@ -250,7 +250,7 @@ where
}
}
impl<'a, S> ToInputValue<S> for &'a str
impl<S> ToInputValue<S> for &str
where
S: ScalarValue,
{

View file

@ -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, ""),

View file

@ -28,7 +28,7 @@ impl<A, B> MultiVisitorCons<A, B> {
}
}
impl<'a, S> Visitor<'a, S> for MultiVisitorNil where S: ScalarValue {}
impl<S> Visitor<'_, S> for MultiVisitorNil where S: ScalarValue {}
impl<'a, A, B, S> Visitor<'a, S> for MultiVisitorCons<A, B>
where

View file

@ -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<T: Default + Parse + Token>(&self) -> syn::Result<Option<T>> {
Ok(if self.is_next::<T>() {
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) => {

View file

@ -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| {

View file

@ -254,7 +254,7 @@ pub struct GraphQLContext<'f, S: ScalarValue> {
errors: Errors<'f>,
}
impl<'f, S: ScalarValue> GraphQLContext<'f, S> {
impl<S: ScalarValue> GraphQLContext<'_, S> {
fn query(&mut self, value: String) {
if self.query.is_some() {
let error = Error::from(ErrorKind::Duplicate).with_name("query");

View file

@ -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<S>`:
`&'a T` implements `ToInputValue<S>`
`&'a [T]` implements `ToInputValue<S>`
`&'a str` implements `ToInputValue<S>`
`&T` implements `ToInputValue<S>`
`&[T]` implements `ToInputValue<S>`
`&str` implements `ToInputValue<S>`
`Arc<T>` implements `ToInputValue<S>`
`Box<T>` implements `ToInputValue<S>`
`ID` implements `ToInputValue<__S>`

View file

@ -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()
}

View file

@ -94,7 +94,7 @@ impl<'de> Deserialize<'de> for MyScalarValue {
fn deserialize<D: Deserializer<'de>>(de: D) -> Result<Self, D::Error> {
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 {