Skip to content

Commit aea0ef2

Browse files
committed
Make Clippy happy for 1.77 Rust
1 parent 6cf1bb3 commit aea0ef2

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

juniper_codegen/src/common/diagnostic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ mod polyfill {
255255
}
256256

257257
thread_local! {
258-
static ENTERED_ENTRY_POINT: Cell<usize> = Cell::new(0);
258+
static ENTERED_ENTRY_POINT: Cell<usize> = const { Cell::new(0) };
259259
}
260260

261261
/// This is the entry point for a macro to support [`Diagnostic`]s.
@@ -312,7 +312,7 @@ mod polyfill {
312312
}
313313

314314
thread_local! {
315-
static ERR_STORAGE: RefCell<Vec<Diagnostic>> = RefCell::new(Vec::new());
315+
static ERR_STORAGE: RefCell<Vec<Diagnostic>> = const { RefCell::new(Vec::new()) };
316316
}
317317

318318
/// Emits the provided [`Diagnostic`], while not aborting macro execution.

juniper_codegen/src/scalar_value/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -450,14 +450,14 @@ enum Field {
450450
Named(syn::Field),
451451

452452
/// Unnamed [`Field`].
453-
Unnamed(syn::Field),
453+
Unnamed,
454454
}
455455

456456
impl ToTokens for Field {
457457
fn to_tokens(&self, tokens: &mut TokenStream) {
458458
match self {
459459
Self::Named(f) => f.ident.to_tokens(tokens),
460-
Self::Unnamed(_) => tokens.append(Literal::u8_unsuffixed(0)),
460+
Self::Unnamed => tokens.append(Literal::u8_unsuffixed(0)),
461461
}
462462
}
463463
}
@@ -470,9 +470,7 @@ impl TryFrom<syn::Fields> for Field {
470470
syn::Fields::Named(mut f) if f.named.len() == 1 => {
471471
Ok(Self::Named(f.named.pop().unwrap().into_value()))
472472
}
473-
syn::Fields::Unnamed(mut f) if f.unnamed.len() == 1 => {
474-
Ok(Self::Unnamed(f.unnamed.pop().unwrap().into_value()))
475-
}
473+
syn::Fields::Unnamed(f) if f.unnamed.len() == 1 => Ok(Self::Unnamed),
476474
_ => Err(ERR.custom_error(value.span(), "expected exactly 1 field")),
477475
}
478476
}
@@ -483,7 +481,7 @@ impl Field {
483481
fn match_arg(&self) -> TokenStream {
484482
match self {
485483
Self::Named(_) => quote! { { #self: v } },
486-
Self::Unnamed(_) => quote! { (v) },
484+
Self::Unnamed => quote! { (v) },
487485
}
488486
}
489487
}

tests/integration/tests/codegen_enum_derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ mod bounded_generic_scalar {
900900
mod explicit_custom_context {
901901
use super::*;
902902

903-
struct CustomContext(prelude::String);
903+
struct CustomContext(#[allow(dead_code)] prelude::String);
904904

905905
impl juniper::Context for CustomContext {}
906906

tests/integration/tests/codegen_union_derive.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ mod external_resolver_enum_variant {
10971097
enum Character {
10981098
A(Human),
10991099
#[graphql(with = Character::as_droid)]
1100-
B(Droid),
1100+
B(#[allow(dead_code)] Droid),
11011101
}
11021102

11031103
impl Character {

0 commit comments

Comments
 (0)