Skip to content

Commit 04129e1

Browse files
committed
Tune lints for 1.91 Rust
Additionally: - update codegen failure tests for 1.91 Rust
1 parent b337c8b commit 04129e1

37 files changed

+255
-65
lines changed

juniper/src/types/nullable.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ use crate::{
3030
///
3131
/// In cases where you do not need to be able to distinguish between the two types of null, you
3232
/// should simply use `Option<T>`.
33-
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33+
#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3434
pub enum Nullable<T> {
3535
/// No value
36+
#[default]
3637
ImplicitNull,
3738

3839
/// No value, explicitly specified to be null
@@ -42,14 +43,6 @@ pub enum Nullable<T> {
4243
Some(T),
4344
}
4445

45-
// Implemented manually to omit redundant `T: Default` trait bound, imposed by
46-
// `#[derive(Default)]`.
47-
impl<T> Default for Nullable<T> {
48-
fn default() -> Self {
49-
Self::ImplicitNull
50-
}
51-
}
52-
5346
impl<T> Nullable<T> {
5447
/// Returns `true` if the nullable is a `ExplicitNull` value.
5548
#[inline]

juniper_graphql_ws/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
1+
#![cfg_attr(docsrs, feature(doc_cfg))]
22
#![cfg_attr(any(doc, test), doc = include_str!("../README.md"))]
33
#![cfg_attr(not(any(doc, test)), doc = env!("CARGO_PKG_NAME"))]
44

tests/codegen/fail/input_object/enum/derive_incompatible_field_type.stderr

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied
22
--> fail/input_object/enum/derive_incompatible_field_type.rs:8:10
33
|
44
8 | #[derive(GraphQLInputObject)]
5-
| ^^^^^^^^^^^^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA`
5+
| ^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
66
|
7+
help: the trait `IsInputType<__S>` is not implemented for `ObjectA`
8+
--> fail/input_object/enum/derive_incompatible_field_type.rs:4:1
9+
|
10+
4 | struct ObjectA {
11+
| ^^^^^^^^^^^^^^
712
= help: the following other types implement trait `IsInputType<S>`:
813
`&T` implements `IsInputType<S>`
914
`Arc<T>` implements `IsInputType<S>`
@@ -21,8 +26,13 @@ error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
2126
--> fail/input_object/enum/derive_incompatible_field_type.rs:8:10
2227
|
2328
8 | #[derive(GraphQLInputObject)]
24-
| ^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjectA`
29+
| ^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
30+
|
31+
help: the trait `FromInputValue<__S>` is not implemented for `ObjectA`
32+
--> fail/input_object/enum/derive_incompatible_field_type.rs:4:1
2533
|
34+
4 | struct ObjectA {
35+
| ^^^^^^^^^^^^^^
2636
= help: the following other types implement trait `FromInputValue<S>`:
2737
`Arc<T>` implements `FromInputValue<S>`
2838
`ArcStr` implements `FromInputValue<__S>`
@@ -48,8 +58,13 @@ error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
4858
--> fail/input_object/enum/derive_incompatible_field_type.rs:8:10
4959
|
5060
8 | #[derive(GraphQLInputObject)]
51-
| ^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjectA`
61+
| ^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
5262
|
63+
help: the trait `FromInputValue<__S>` is not implemented for `ObjectA`
64+
--> fail/input_object/enum/derive_incompatible_field_type.rs:4:1
65+
|
66+
4 | struct ObjectA {
67+
| ^^^^^^^^^^^^^^
5368
= help: the following other types implement trait `FromInputValue<S>`:
5469
`Arc<T>` implements `FromInputValue<S>`
5570
`ArcStr` implements `FromInputValue<__S>`
@@ -66,8 +81,13 @@ error[E0277]: the trait bound `ObjectA: ToInputValue<_>` is not satisfied
6681
--> fail/input_object/enum/derive_incompatible_field_type.rs:8:10
6782
|
6883
8 | #[derive(GraphQLInputObject)]
69-
| ^^^^^^^^^^^^^^^^^^ the trait `ToInputValue<_>` is not implemented for `ObjectA`
84+
| ^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
85+
|
86+
help: the trait `ToInputValue<_>` is not implemented for `ObjectA`
87+
--> fail/input_object/enum/derive_incompatible_field_type.rs:4:1
7088
|
89+
4 | struct ObjectA {
90+
| ^^^^^^^^^^^^^^
7191
= help: the following other types implement trait `ToInputValue<S>`:
7292
`&T` implements `ToInputValue<S>`
7393
`Arc<T>` implements `ToInputValue<S>`

tests/codegen/fail/input_object/struct/derive_incompatible_field_type.stderr

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied
22
--> fail/input_object/struct/derive_incompatible_field_type.rs:10:12
33
|
44
10 | field: ObjectA,
5-
| ^^^^^^^ the trait `IsInputType<__S>` is not implemented for `ObjectA`
5+
| ^^^^^^^ unsatisfied trait bound
66
|
7+
help: the trait `IsInputType<__S>` is not implemented for `ObjectA`
8+
--> fail/input_object/struct/derive_incompatible_field_type.rs:4:1
9+
|
10+
4 | struct ObjectA {
11+
| ^^^^^^^^^^^^^^
712
= help: the following other types implement trait `IsInputType<S>`:
813
`&T` implements `IsInputType<S>`
914
`Arc<T>` implements `IsInputType<S>`
@@ -22,8 +27,13 @@ error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
2227
| ------------------ required by a bound introduced by this call
2328
9 | struct Object {
2429
10 | field: ObjectA,
25-
| ^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjectA`
30+
| ^^^^^^^ unsatisfied trait bound
31+
|
32+
help: the trait `FromInputValue<__S>` is not implemented for `ObjectA`
33+
--> fail/input_object/struct/derive_incompatible_field_type.rs:4:1
2634
|
35+
4 | struct ObjectA {
36+
| ^^^^^^^^^^^^^^
2737
= help: the following other types implement trait `FromInputValue<S>`:
2838
`Arc<T>` implements `FromInputValue<S>`
2939
`ArcStr` implements `FromInputValue<__S>`
@@ -47,8 +57,13 @@ error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
4757
--> fail/input_object/struct/derive_incompatible_field_type.rs:8:10
4858
|
4959
8 | #[derive(GraphQLInputObject)]
50-
| ^^^^^^^^^^^^^^^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjectA`
60+
| ^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
5161
|
62+
help: the trait `FromInputValue<__S>` is not implemented for `ObjectA`
63+
--> fail/input_object/struct/derive_incompatible_field_type.rs:4:1
64+
|
65+
4 | struct ObjectA {
66+
| ^^^^^^^^^^^^^^
5267
= help: the following other types implement trait `FromInputValue<S>`:
5368
`Arc<T>` implements `FromInputValue<S>`
5469
`ArcStr` implements `FromInputValue<__S>`
@@ -65,8 +80,13 @@ error[E0277]: the trait bound `ObjectA: ToInputValue<_>` is not satisfied
6580
--> fail/input_object/struct/derive_incompatible_field_type.rs:8:10
6681
|
6782
8 | #[derive(GraphQLInputObject)]
68-
| ^^^^^^^^^^^^^^^^^^ the trait `ToInputValue<_>` is not implemented for `ObjectA`
83+
| ^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
84+
|
85+
help: the trait `ToInputValue<_>` is not implemented for `ObjectA`
86+
--> fail/input_object/struct/derive_incompatible_field_type.rs:4:1
6987
|
88+
4 | struct ObjectA {
89+
| ^^^^^^^^^^^^^^
7090
= help: the following other types implement trait `ToInputValue<S>`:
7191
`&T` implements `ToInputValue<S>`
7292
`Arc<T>` implements `ToInputValue<S>`

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
22
--> fail/interface/struct/attr_field_non_output_return_type.rs:8:1
33
|
44
8 | #[graphql_interface]
5-
| ^^^^^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
5+
| ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
66
|
7+
help: the trait `IsOutputType<__S>` is not implemented for `ObjB`
8+
--> fail/interface/struct/attr_field_non_output_return_type.rs:4:1
9+
|
10+
4 | pub struct ObjB {
11+
| ^^^^^^^^^^^^^^^
712
= help: the following other types implement trait `IsOutputType<S>`:
813
`&T` implements `IsOutputType<S>`
914
`Arc<T>` implements `IsOutputType<S>`

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ error: cannot find attribute `graphql` in this scope
1010
|
1111
7 | #[graphql(name = "id")]
1212
| ^^^^^^^
13+
|
14+
= note: `graphql` is an attribute that can be used by the derive macros `GraphQLEnum`, `GraphQLInputObject`, `GraphQLInterface`, `GraphQLObject`, `GraphQLScalar` and `GraphQLUnion`, you might be missing a `derive` attribute

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ error[E0277]: the trait bound `ObjA: reflect::Field<__S, 11301463986558097276003
3434
--> fail/interface/struct/attr_missing_field.rs:11:5
3535
|
3636
11 | id: String,
37-
| ^^ the trait `reflect::Field<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
37+
| ^^ unsatisfied trait bound
3838
|
3939
= help: the trait `Field<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
4040
but trait `Field<__S, 140650918148392961738240285796466530725>` is implemented for it
@@ -51,7 +51,7 @@ error[E0277]: the trait bound `ObjA: AsyncField<__S, 113014639865580972760039031
5151
--> fail/interface/struct/attr_missing_field.rs:11:5
5252
|
5353
11 | id: String,
54-
| ^^ the trait `AsyncField<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
54+
| ^^ unsatisfied trait bound
5555
|
5656
= help: the trait `AsyncField<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
5757
but trait `AsyncField<__S, 140650918148392961738240285796466530725>` is implemented for it

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ error[E0277]: the trait bound `ObjB: IsOutputType<__S>` is not satisfied
22
--> fail/interface/struct/derive_field_non_output_return_type.rs:8:10
33
|
44
8 | #[derive(GraphQLInterface)]
5-
| ^^^^^^^^^^^^^^^^ the trait `IsOutputType<__S>` is not implemented for `ObjB`
5+
| ^^^^^^^^^^^^^^^^ unsatisfied trait bound
66
|
7+
help: the trait `IsOutputType<__S>` is not implemented for `ObjB`
8+
--> fail/interface/struct/derive_field_non_output_return_type.rs:4:1
9+
|
10+
4 | pub struct ObjB {
11+
| ^^^^^^^^^^^^^^^
712
= help: the following other types implement trait `IsOutputType<S>`:
813
`&T` implements `IsOutputType<S>`
914
`Arc<T>` implements `IsOutputType<S>`

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ error[E0277]: the trait bound `ObjA: reflect::Field<__S, 11301463986558097276003
3434
--> fail/interface/struct/derive_missing_field.rs:12:5
3535
|
3636
12 | id: String,
37-
| ^^ the trait `reflect::Field<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
37+
| ^^ unsatisfied trait bound
3838
|
3939
= help: the trait `Field<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
4040
but trait `Field<__S, 140650918148392961738240285796466530725>` is implemented for it
@@ -51,7 +51,7 @@ error[E0277]: the trait bound `ObjA: AsyncField<__S, 113014639865580972760039031
5151
--> fail/interface/struct/derive_missing_field.rs:12:5
5252
|
5353
12 | id: String,
54-
| ^^ the trait `AsyncField<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
54+
| ^^ unsatisfied trait bound
5555
|
5656
= help: the trait `AsyncField<__S, 11301463986558097276003903130001171064>` is not implemented for `ObjA`
5757
but trait `AsyncField<__S, 140650918148392961738240285796466530725>` is implemented for it

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,13 @@ error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
22
--> fail/interface/trait/argument_non_input_type.rs:10:23
33
|
44
10 | fn id(&self, obj: ObjA) -> &str;
5-
| ^^^^ the trait `IsInputType<__S>` is not implemented for `ObjA`
5+
| ^^^^ unsatisfied trait bound
66
|
7+
help: the trait `IsInputType<__S>` is not implemented for `ObjA`
8+
--> fail/interface/trait/argument_non_input_type.rs:4:1
9+
|
10+
4 | pub struct ObjA {
11+
| ^^^^^^^^^^^^^^^
712
= help: the following other types implement trait `IsInputType<S>`:
813
`&T` implements `IsInputType<S>`
914
`Arc<T>` implements `IsInputType<S>`
@@ -22,8 +27,13 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
2227
| -------------------- required by a bound introduced by this call
2328
9 | trait Character {
2429
10 | fn id(&self, obj: ObjA) -> &str;
25-
| ^^^^ the trait `FromInputValue<__S>` is not implemented for `ObjA`
30+
| ^^^^ unsatisfied trait bound
31+
|
32+
help: the trait `FromInputValue<__S>` is not implemented for `ObjA`
33+
--> fail/interface/trait/argument_non_input_type.rs:4:1
2634
|
35+
4 | pub struct ObjA {
36+
| ^^^^^^^^^^^^^^^
2737
= help: the following other types implement trait `FromInputValue<S>`:
2838
`Arc<T>` implements `FromInputValue<S>`
2939
`ArcStr` implements `FromInputValue<__S>`

0 commit comments

Comments
 (0)