Make Clippy happy for 1.77 Rust

This commit is contained in:
tyranron 2024-03-22 17:59:16 +02:00
parent 6cf1bb30da
commit aea0ef2549
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
4 changed files with 8 additions and 10 deletions

View file

@ -255,7 +255,7 @@ mod polyfill {
}
thread_local! {
static ENTERED_ENTRY_POINT: Cell<usize> = Cell::new(0);
static ENTERED_ENTRY_POINT: Cell<usize> = const { Cell::new(0) };
}
/// This is the entry point for a macro to support [`Diagnostic`]s.
@ -312,7 +312,7 @@ mod polyfill {
}
thread_local! {
static ERR_STORAGE: RefCell<Vec<Diagnostic>> = RefCell::new(Vec::new());
static ERR_STORAGE: RefCell<Vec<Diagnostic>> = const { RefCell::new(Vec::new()) };
}
/// Emits the provided [`Diagnostic`], while not aborting macro execution.

View file

@ -450,14 +450,14 @@ enum Field {
Named(syn::Field),
/// Unnamed [`Field`].
Unnamed(syn::Field),
Unnamed,
}
impl ToTokens for Field {
fn to_tokens(&self, tokens: &mut TokenStream) {
match self {
Self::Named(f) => f.ident.to_tokens(tokens),
Self::Unnamed(_) => tokens.append(Literal::u8_unsuffixed(0)),
Self::Unnamed => tokens.append(Literal::u8_unsuffixed(0)),
}
}
}
@ -470,9 +470,7 @@ impl TryFrom<syn::Fields> for Field {
syn::Fields::Named(mut f) if f.named.len() == 1 => {
Ok(Self::Named(f.named.pop().unwrap().into_value()))
}
syn::Fields::Unnamed(mut f) if f.unnamed.len() == 1 => {
Ok(Self::Unnamed(f.unnamed.pop().unwrap().into_value()))
}
syn::Fields::Unnamed(f) if f.unnamed.len() == 1 => Ok(Self::Unnamed),
_ => Err(ERR.custom_error(value.span(), "expected exactly 1 field")),
}
}
@ -483,7 +481,7 @@ impl Field {
fn match_arg(&self) -> TokenStream {
match self {
Self::Named(_) => quote! { { #self: v } },
Self::Unnamed(_) => quote! { (v) },
Self::Unnamed => quote! { (v) },
}
}
}

View file

@ -900,7 +900,7 @@ mod bounded_generic_scalar {
mod explicit_custom_context {
use super::*;
struct CustomContext(prelude::String);
struct CustomContext(#[allow(dead_code)] prelude::String);
impl juniper::Context for CustomContext {}

View file

@ -1097,7 +1097,7 @@ mod external_resolver_enum_variant {
enum Character {
A(Human),
#[graphql(with = Character::as_droid)]
B(Droid),
B(#[allow(dead_code)] Droid),
}
impl Character {