Skip to content

Commit 68e51cb

Browse files
committed
Tune lints for 1.87 Rust
Additionally: - update codegen tests for 1.87 Rust
1 parent f168a02 commit 68e51cb

28 files changed

+40
-54
lines changed

juniper/src/executor_tests/interfaces_unions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ mod interface {
77

88
// TODO: Consider this for the GraphQL interfaces in the expansion.
99
#[expect(dead_code, reason = "GraphQL schema testing")]
10-
#[graphql_interface(for = [Cat, Dog])]
10+
#[graphql_interface]
11+
#[graphql(for = [Cat, Dog])]
1112
trait Pet {
1213
fn name(&self) -> &str;
1314
}

juniper/src/executor_tests/introspection/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ struct Scalar(i32);
2525
/// A sample interface
2626
// TODO: Consider this for the GraphQL interfaces in the expansion.
2727
#[expect(dead_code, reason = "GraphQL schema testing")]
28-
#[graphql_interface(name = "SampleInterface", for = Root)]
28+
#[graphql_interface]
29+
#[graphql(name = "SampleInterface", for = Root)]
2930
trait Interface {
3031
/// A sample field in the interface
3132
fn sample_enum(&self) -> Sample;

juniper/src/types/containers.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,6 @@ where
375375
});
376376
}
377377
if N == 0 {
378-
// TODO: Use `mem::transmute` instead of
379-
// `mem::transmute_copy` below, once it's allowed
380-
// for const generics:
381-
// https://github.com/rust-lang/rust/issues/61956
382378
// SAFETY: `mem::transmute_copy` is safe here, because we
383379
// check `N` to be `0`. It's no-op, actually.
384380
return Ok(unsafe { mem::transmute_copy::<[T; 0], Self>(&[]) });
@@ -418,9 +414,9 @@ where
418414
// them.
419415
out.no_drop = true;
420416

421-
// TODO: Use `mem::transmute` instead of `mem::transmute_copy`
422-
// below, once it's allowed for const generics:
423-
// https://github.com/rust-lang/rust/issues/61956
417+
// TODO: Use `MaybeUninit::array_assume_init()` instead of `mem::transmute_copy`
418+
// below, once it's in stable Rust:
419+
// https://github.com/rust-lang/rust/issues/96097
424420
// SAFETY: `mem::transmute_copy` is safe here, because we have
425421
// exactly `N` initialized `items`.
426422
// Also, despite `mem::transmute_copy` copies the value,
@@ -437,10 +433,6 @@ where
437433
.convert()
438434
.map_err(FromInputValueArrayError::Item)
439435
.and_then(|e: T| {
440-
// TODO: Use `mem::transmute` instead of
441-
// `mem::transmute_copy` below, once it's allowed
442-
// for const generics:
443-
// https://github.com/rust-lang/rust/issues/61956
444436
if N == 1 {
445437
// SAFETY: `mem::transmute_copy` is safe here,
446438
// because we check `N` to be `1`.
@@ -451,7 +443,9 @@ where
451443
// `mem::ManuallyDrop`, so does nothing on
452444
// `Drop`.
453445
Ok(unsafe {
454-
mem::transmute_copy::<_, Self>(&[mem::ManuallyDrop::new(e)])
446+
mem::transmute_copy::<[mem::ManuallyDrop<T>; 1], Self>(&[
447+
mem::ManuallyDrop::new(e),
448+
])
455449
})
456450
} else {
457451
Err(FromInputValueArrayError::WrongCount {

juniper/src/validation/rules/overlapping_fields_can_be_merged.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ impl<'a, S: Debug> OverlappingFieldsCanBeMerged<'a, S> {
685685
item: FragmentSpread { ref name, .. },
686686
..
687687
}) => {
688-
if !fragment_names.iter().any(|n| *n == name.item) {
688+
if !fragment_names.contains(&name.item) {
689689
fragment_names.push(name.item);
690690
}
691691
}

juniper_axum/src/extract.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ where
9494
.into_response()
9595
})?;
9696

97-
// TODO: Move into `match` expression directly once MSRV is bumped higher than 1.74.
98-
let method = req.method();
99-
match (method, content_type) {
97+
match (req.method(), content_type) {
10098
(&Method::GET, _) => req
10199
.extract_parts::<Query<GetRequest>>()
102100
.await

juniper_codegen/src/scalar_value/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ impl Variant {
446446
#[derive(Clone)]
447447
enum Field {
448448
/// Named [`Field`].
449-
Named(syn::Field),
449+
Named(Box<syn::Field>),
450450

451451
/// Unnamed [`Field`].
452452
Unnamed,
@@ -467,7 +467,7 @@ impl TryFrom<syn::Fields> for Field {
467467
fn try_from(value: syn::Fields) -> Result<Self, Self::Error> {
468468
match value {
469469
syn::Fields::Named(mut f) if f.named.len() == 1 => {
470-
Ok(Self::Named(f.named.pop().unwrap().into_value()))
470+
Ok(Self::Named(Box::new(f.named.pop().unwrap().into_value())))
471471
}
472472
syn::Fields::Unnamed(f) if f.unnamed.len() == 1 => Ok(Self::Unnamed),
473473
_ => Err(ERR.custom_error(value.span(), "expected exactly 1 field")),

tests/codegen/fail/interface/struct/attr_additional_non_nullable_argument.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/attr_additional_non_nullable_argument.rs:16:5
33
|
44
16 | id: String,
5-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.', $DIR/fail/interface/struct/attr_additional_non_nullable_argument.rs:16:5
5+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/attr_missing_field.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/attr_missing_field.rs:11:5
33
|
44
11 | id: String,
5-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/attr_missing_field.rs:11:5
5+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
error[E0080]: evaluation of constant value failed
1010
--> fail/interface/struct/attr_missing_field.rs:11:5
1111
|
1212
11 | id: String,
13-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/attr_missing_field.rs:11:5
13+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
1414
|
1515
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

1717
error[E0080]: evaluation of constant value failed
1818
--> fail/interface/struct/attr_missing_field.rs:11:5
1919
|
2020
11 | id: String,
21-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/attr_missing_field.rs:11:5
21+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
2222
|
2323
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
2424

tests/codegen/fail/interface/struct/attr_missing_for_attr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/attr_missing_for_attr.rs:3:10
33
|
44
3 | #[derive(GraphQLObject)]
5-
| ^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing implementer reference in interface's `for` attribute.', $DIR/fail/interface/struct/attr_missing_for_attr.rs:3:10
5+
| ^^^^^^^^^^^^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: missing implementer reference in interface's `for` attribute.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the derive macro `GraphQLObject` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/attr_missing_impl_attr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/attr_missing_impl_attr.rs:8:1
33
|
44
8 | #[graphql_interface(for = ObjA)]
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing interface reference in implementer's `impl` attribute.', $DIR/fail/interface/struct/attr_missing_impl_attr.rs:8:1
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: missing interface reference in implementer's `impl` attribute.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/attr_missing_transitive_impl.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/attr_missing_transitive_impl.rs:8:46
33
|
44
8 | #[graphql_interface(impl = Node1Value, for = Node3Value)]
5-
| ^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Node2` on `Node3`: missing `impl = ` for transitive interface `Node1` on `Node3`.', $DIR/fail/interface/struct/attr_missing_transitive_impl.rs:8:46
5+
| ^^^^^^^^^^ evaluation panicked: Failed to implement interface `Node2` on `Node3`: missing `impl = ` for transitive interface `Node1` on `Node3`.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_transitive_impls` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/attr_non_subtype_return.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/attr_non_subtype_return.rs:11:5
33
|
44
11 | id: String,
5-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of interface's return object: `[String!]!` is not a subtype of `String!`.', $DIR/fail/interface/struct/attr_non_subtype_return.rs:11:5
5+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of interface's return object: `[String!]!` is not a subtype of `String!`.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/derive_additional_non_nullable_argument.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/derive_additional_non_nullable_argument.rs:17:5
33
|
44
17 | id: String,
5-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.', $DIR/fail/interface/struct/derive_additional_non_nullable_argument.rs:17:5
5+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/derive_missing_field.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/derive_missing_field.rs:12:5
33
|
44
12 | id: String,
5-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/derive_missing_field.rs:12:5
5+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
error[E0080]: evaluation of constant value failed
1010
--> fail/interface/struct/derive_missing_field.rs:12:5
1111
|
1212
12 | id: String,
13-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/derive_missing_field.rs:12:5
13+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
1414
|
1515
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

1717
error[E0080]: evaluation of constant value failed
1818
--> fail/interface/struct/derive_missing_field.rs:12:5
1919
|
2020
12 | id: String,
21-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/struct/derive_missing_field.rs:12:5
21+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
2222
|
2323
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
2424

tests/codegen/fail/interface/struct/derive_missing_for_attr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/derive_missing_for_attr.rs:3:10
33
|
44
3 | #[derive(GraphQLObject)]
5-
| ^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing implementer reference in interface's `for` attribute.', $DIR/fail/interface/struct/derive_missing_for_attr.rs:3:10
5+
| ^^^^^^^^^^^^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: missing implementer reference in interface's `for` attribute.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the derive macro `GraphQLObject` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/derive_missing_impl_attr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/derive_missing_impl_attr.rs:8:10
33
|
44
8 | #[derive(GraphQLInterface)]
5-
| ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: missing interface reference in implementer's `impl` attribute.', $DIR/fail/interface/struct/derive_missing_impl_attr.rs:8:10
5+
| ^^^^^^^^^^^^^^^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: missing interface reference in implementer's `impl` attribute.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the derive macro `GraphQLInterface` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/derive_missing_transitive_impl.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/derive_missing_transitive_impl.rs:10:36
33
|
44
10 | #[graphql(impl = Node1Value, for = Node3Value)]
5-
| ^^^^^^^^^^ the evaluated program panicked at 'Failed to implement interface `Node2` on `Node3`: missing `impl = ` for transitive interface `Node1` on `Node3`.', $DIR/fail/interface/struct/derive_missing_transitive_impl.rs:10:36
5+
| ^^^^^^^^^^ evaluation panicked: Failed to implement interface `Node2` on `Node3`: missing `impl = ` for transitive interface `Node1` on `Node3`.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_transitive_impls` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/struct/derive_non_subtype_return.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/struct/derive_non_subtype_return.rs:12:5
33
|
44
12 | id: String,
5-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of interface's return object: `[String!]!` is not a subtype of `String!`.', $DIR/fail/interface/struct/derive_non_subtype_return.rs:12:5
5+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id`: implementor is expected to return a subtype of interface's return object: `[String!]!` is not a subtype of `String!`.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/trait/additional_non_nullable_argument.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/trait/additional_non_nullable_argument.rs:16:8
33
|
44
16 | fn id(&self) -> &str;
5-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.', $DIR/fail/interface/trait/additional_non_nullable_argument.rs:16:8
5+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id`: Argument `isPresent` of type `Boolean!` isn't present on the interface and so has to be nullable.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)

tests/codegen/fail/interface/trait/missing_field.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ error[E0080]: evaluation of constant value failed
22
--> fail/interface/trait/missing_field.rs:11:8
33
|
44
11 | fn id(&self) -> &str;
5-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/trait/missing_field.rs:11:8
5+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
66
|
77
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
88

99
error[E0080]: evaluation of constant value failed
1010
--> fail/interface/trait/missing_field.rs:11:8
1111
|
1212
11 | fn id(&self) -> &str;
13-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/trait/missing_field.rs:11:8
13+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
1414
|
1515
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
1616

1717
error[E0080]: evaluation of constant value failed
1818
--> fail/interface/trait/missing_field.rs:11:8
1919
|
2020
11 | fn id(&self) -> &str;
21-
| ^^ the evaluated program panicked at 'Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.', $DIR/fail/interface/trait/missing_field.rs:11:8
21+
| ^^ evaluation panicked: Failed to implement interface `Character` on `ObjA`: Field `id` isn't implemented on `ObjA`.
2222
|
2323
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `::juniper::assert_field` (in Nightly builds, run with -Z macro-backtrace for more info)
2424

0 commit comments

Comments
 (0)