Make Clippy happy for 1.78 Rust

This commit is contained in:
tyranron 2024-05-02 17:31:20 +02:00
parent 6ffbb66719
commit 2682ee1418
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
22 changed files with 191 additions and 125 deletions

View file

@ -40,9 +40,9 @@ impl<'a, T> SchemaTranslator<'a, graphql_parser::schema::Document<'a, T>>
where
T: Text<'a> + Default,
{
fn translate_schema<S: 'a>(input: &'a SchemaType<S>) -> graphql_parser::schema::Document<'a, T>
fn translate_schema<S>(input: &'a SchemaType<S>) -> graphql_parser::schema::Document<'a, T>
where
S: ScalarValue,
S: ScalarValue + 'a,
{
let mut doc = Document::default();
@ -94,9 +94,9 @@ impl GraphQLParserTranslator {
}
}
fn translate_value<'a, S: 'a, T>(input: &'a InputValue<S>) -> ExternalValue<'a, T>
fn translate_value<'a, S, T>(input: &'a InputValue<S>) -> ExternalValue<'a, T>
where
S: ScalarValue,
S: ScalarValue + 'a,
T: Text<'a>,
{
match input {
@ -250,9 +250,9 @@ impl GraphQLParserTranslator {
}
}
fn translate_field<'a, S: 'a, T>(input: &'a Field<S>) -> ExternalField<'a, T>
fn translate_field<'a, S, T>(input: &'a Field<S>) -> ExternalField<'a, T>
where
S: ScalarValue,
S: ScalarValue + 'a,
T: Text<'a>,
{
let arguments = input

View file

@ -1,5 +1,6 @@
use crate::{ScalarValue, SchemaType};
#[cfg_attr(not(feature = "schema-language"), allow(dead_code))]
pub trait SchemaTranslator<'a, T> {
fn translate_schema<S: 'a + ScalarValue>(s: &'a SchemaType<S>) -> T;
}

View file

@ -35,9 +35,9 @@ use crate::{
};
#[doc(hidden)]
pub fn visit_all_rules<'a, S: Debug>(ctx: &mut ValidatorContext<'a, S>, doc: &'a Document<S>)
pub fn visit_all_rules<'a, S>(ctx: &mut ValidatorContext<'a, S>, doc: &'a Document<S>)
where
S: ScalarValue,
S: Debug + ScalarValue,
{
// Some validators are depending on the results of other ones.
// For example, validators checking fragments usually rely on the fact that

View file

@ -59,26 +59,26 @@ impl<K: Eq + Hash + Clone, V> OrderedMap<K, V> {
}
}
fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V>
fn get<Q>(&self, k: &Q) -> Option<&V>
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
self.data.get(k)
}
fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
fn get_mut<Q>(&mut self, k: &Q) -> Option<&mut V>
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
self.data.get_mut(k)
}
fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
fn contains_key<Q>(&self, k: &Q) -> bool
where
K: Borrow<Q>,
Q: Hash + Eq,
Q: Hash + Eq + ?Sized,
{
self.data.contains_key(k)
}

View file

@ -342,12 +342,6 @@ mod polyfill {
/// Behaves like [`Result::unwrap()`]: if `self` is [`Ok`] yield the contained value,
/// otherwise abort macro execution.
fn unwrap_or_abort(self) -> Self::Ok;
/// Behaves like [`Result::expect()`]: if `self` is [`Ok`] yield the contained value,
/// otherwise abort macro execution.
///
/// If it aborts then resulting error message will be preceded with the provided `message`.
fn expect_or_abort(self, message: &str) -> Self::Ok;
}
impl<T, E: Into<Diagnostic>> ResultExt for Result<T, E> {
@ -356,13 +350,5 @@ mod polyfill {
fn unwrap_or_abort(self) -> T {
self.unwrap_or_else(|e| e.into().abort())
}
fn expect_or_abort(self, message: &str) -> T {
self.unwrap_or_else(|e| {
let mut d = e.into();
d.msg = format!("{message}: {}", d.msg);
d.abort()
})
}
}
}

View file

@ -252,10 +252,6 @@ impl TypeExt for syn::Type {
/// Extension of [`syn::Generics`] providing common function widely used by this crate for parsing.
pub(crate) trait GenericsExt {
/// Removes all default types out of type parameters and const parameters in these
/// [`syn::Generics`].
fn remove_defaults(&mut self);
/// Moves all trait and lifetime bounds of these [`syn::Generics`] to its [`syn::WhereClause`].
fn move_bounds_to_where_clause(&mut self);
@ -269,24 +265,6 @@ pub(crate) trait GenericsExt {
}
impl GenericsExt for syn::Generics {
fn remove_defaults(&mut self) {
use syn::GenericParam as P;
for p in &mut self.params {
match p {
P::Type(p) => {
p.eq_token = None;
p.default = None;
}
P::Lifetime(_) => {}
P::Const(p) => {
p.eq_token = None;
p.default = None;
}
}
}
}
fn move_bounds_to_where_clause(&mut self) {
use syn::GenericParam as P;

View file

@ -401,7 +401,7 @@ impl Definition {
let enum_gens = {
let mut enum_gens = interface_gens.clone();
enum_gens.params = interface_gens_lifetimes.clone();
enum_gens.params.clone_from(&interface_gens_lifetimes);
enum_gens.params.extend(variant_gens_pars.clone());
enum_gens.params.extend(interface_gens_tys.clone());
enum_gens

View file

@ -12,7 +12,7 @@ error[E0277]: the trait bound `ObjectA: IsInputType<__S>` is not satisfied
<Box<T> as IsInputType<S>>
<juniper::schema::model::DirectiveLocation as IsInputType<__S>>
<Arc<T> as IsInputType<S>>
<Vec<T> as IsInputType<S>>
<TypeKind as IsInputType<__S>>
and $N others
error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
@ -32,7 +32,7 @@ error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
and $N others
note: required by a bound in `Registry::<'r, S>::arg`
--> $WORKSPACE/juniper/src/executor/mod.rs
@ -57,7 +57,7 @@ error[E0277]: the trait bound `ObjectA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
and $N others
= note: this error originates in the derive macro `GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -75,6 +75,6 @@ error[E0277]: the trait bound `ObjectA: ToInputValue<_>` is not satisfied
<Box<T> as ToInputValue<S>>
<juniper::schema::model::DirectiveLocation as ToInputValue<__S>>
<Arc<T> as ToInputValue<S>>
<Vec<T> as ToInputValue<S>>
<TypeKind as ToInputValue<__S>>
and $N others
= note: this error originates in the derive macro `GraphQLInputObject` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,27 +1,22 @@
error[E0391]: cycle detected when expanding type alias `Node1Value`
--> fail/interface/struct/attr_cyclic_impl.rs:3:46
|
3 | #[graphql_interface(impl = Node2Value, for = Node2Value)]
| ^^^^^^^^^^
|
--> fail/interface/struct/attr_cyclic_impl.rs:3:46
|
3 | #[graphql_interface(impl = Node2Value, for = Node2Value)]
| ^^^^^^^^^^
|
note: ...which requires expanding type alias `Node2Value`...
--> fail/interface/struct/attr_cyclic_impl.rs:8:46
|
8 | #[graphql_interface(impl = Node1Value, for = Node1Value)]
| ^^^^^^^^^^
= note: ...which again requires expanding type alias `Node1Value`, completing the cycle
= note: type aliases cannot be recursive
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when collecting item types in top-level module
--> fail/interface/struct/attr_cyclic_impl.rs:1:1
|
1 | / use juniper::graphql_interface;
2 | |
3 | | #[graphql_interface(impl = Node2Value, for = Node2Value)]
4 | | struct Node1 {
... |
12 | |
13 | | fn main() {}
| |____________^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
--> fail/interface/struct/attr_cyclic_impl.rs:8:46
|
8 | #[graphql_interface(impl = Node1Value, for = Node1Value)]
| ^^^^^^^^^^
= note: ...which again requires expanding type alias `Node1Value`, completing the cycle
= note: type aliases cannot be recursive
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when computing type of `<impl at $DIR/fail/interface/struct/attr_cyclic_impl.rs:3:1: 3:58>`
--> fail/interface/struct/attr_cyclic_impl.rs:3:1
|
3 | #[graphql_interface(impl = Node2Value, for = Node2Value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -13,15 +13,10 @@ note: ...which requires expanding type alias `Node2Value`...
= note: type aliases cannot be recursive
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when collecting item types in top-level module
--> fail/interface/struct/derive_cyclic_impl.rs:1:1
note: cycle used when computing type of `<impl at $DIR/fail/interface/struct/derive_cyclic_impl.rs:3:10: 3:26>`
--> fail/interface/struct/derive_cyclic_impl.rs:3:10
|
1 | / use juniper::GraphQLInterface;
2 | |
3 | | #[derive(GraphQLInterface)]
4 | | #[graphql(impl = Node2Value, for = Node2Value)]
... |
14 | |
15 | | fn main() {}
| |____________^
3 | #[derive(GraphQLInterface)]
| ^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
= note: this error originates in the derive macro `GraphQLInterface` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -11,8 +11,8 @@ error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
<Box<T> as IsInputType<S>>
<juniper::schema::model::DirectiveLocation as IsInputType<__S>>
<Arc<T> as IsInputType<S>>
<Vec<T> as IsInputType<S>>
<TypeKind as IsInputType<__S>>
<Vec<T> as IsInputType<S>>
and $N others
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
@ -31,8 +31,8 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
<Vec<T> as FromInputValue<S>>
and $N others
note: required by a bound in `Registry::<'r, S>::arg`
--> $WORKSPACE/juniper/src/executor/mod.rs

View file

@ -1,27 +1,22 @@
error[E0391]: cycle detected when expanding type alias `Node1Value`
--> fail/interface/trait/cyclic_impl.rs:3:46
|
3 | #[graphql_interface(impl = Node2Value, for = Node2Value)]
| ^^^^^^^^^^
|
--> fail/interface/trait/cyclic_impl.rs:3:46
|
3 | #[graphql_interface(impl = Node2Value, for = Node2Value)]
| ^^^^^^^^^^
|
note: ...which requires expanding type alias `Node2Value`...
--> fail/interface/trait/cyclic_impl.rs:8:46
|
8 | #[graphql_interface(impl = Node1Value, for = Node1Value)]
| ^^^^^^^^^^
= note: ...which again requires expanding type alias `Node1Value`, completing the cycle
= note: type aliases cannot be recursive
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when collecting item types in top-level module
--> fail/interface/trait/cyclic_impl.rs:1:1
|
1 | / use juniper::graphql_interface;
2 | |
3 | | #[graphql_interface(impl = Node2Value, for = Node2Value)]
4 | | trait Node1 {
... |
12 | |
13 | | fn main() {}
| |____________^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
--> fail/interface/trait/cyclic_impl.rs:8:46
|
8 | #[graphql_interface(impl = Node1Value, for = Node1Value)]
| ^^^^^^^^^^
= note: ...which again requires expanding type alias `Node1Value`, completing the cycle
= note: type aliases cannot be recursive
= help: consider using a struct, enum, or union instead to break the cycle
= help: see <https://doc.rust-lang.org/reference/types.html#recursive-types> for more information
note: cycle used when computing type of `<impl at $DIR/fail/interface/trait/cyclic_impl.rs:3:1: 3:58>`
--> fail/interface/trait/cyclic_impl.rs:3:1
|
3 | #[graphql_interface(impl = Node2Value, for = Node2Value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
= note: this error originates in the attribute macro `graphql_interface` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -11,8 +11,8 @@ error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
<Box<T> as IsInputType<S>>
<juniper::schema::model::DirectiveLocation as IsInputType<__S>>
<Arc<T> as IsInputType<S>>
<Vec<T> as IsInputType<S>>
<TypeKind as IsInputType<__S>>
<Vec<T> as IsInputType<S>>
and $N others
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
@ -31,8 +31,8 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
<Vec<T> as FromInputValue<S>>
and $N others
note: required by a bound in `Registry::<'r, S>::arg`
--> $WORKSPACE/juniper/src/executor/mod.rs
@ -56,8 +56,8 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
<Vec<T> as FromInputValue<S>>
and $N others
= note: this error originates in the attribute macro `graphql_object` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -74,6 +74,14 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
<Vec<T> as FromInputValue<S>>
and $N others
warning: unused variable: `obj`
--> fail/object/argument_non_input_type.rs:12:18
|
12 | fn id(&self, obj: ObjA) -> &str {
| ^^^ help: if this is intentional, prefix it with an underscore: `_obj`
|
= note: `#[warn(unused_variables)]` on by default

View file

@ -19,8 +19,8 @@ error[E0277]: the trait bound `ObjA: IsInputType<__S>` is not satisfied
<Box<T> as IsInputType<S>>
<juniper::schema::model::DirectiveLocation as IsInputType<__S>>
<Arc<T> as IsInputType<S>>
<Vec<T> as IsInputType<S>>
<TypeKind as IsInputType<__S>>
<Vec<T> as IsInputType<S>>
and $N others
error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
@ -39,8 +39,8 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
<Vec<T> as FromInputValue<S>>
and $N others
note: required by a bound in `Registry::<'r, S>::arg`
--> $WORKSPACE/juniper/src/executor/mod.rs
@ -64,8 +64,8 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
<Vec<T> as FromInputValue<S>>
and $N others
= note: this error originates in the attribute macro `graphql_subscription` (in Nightly builds, run with -Z macro-backtrace for more info)
@ -82,6 +82,6 @@ error[E0277]: the trait bound `ObjA: FromInputValue<__S>` is not satisfied
<Box<T> as FromInputValue<S>>
<juniper::schema::model::DirectiveLocation as FromInputValue<__S>>
<Arc<T> as FromInputValue<S>>
<Vec<T> as FromInputValue<S>>
<TypeKind as FromInputValue<__S>>
<Vec<T> as FromInputValue<S>>
and $N others

View file

@ -8,3 +8,37 @@ error[E0119]: conflicting implementations of trait `MutuallyExclusive` for type
| conflicting implementation for `std::string::String`
|
= note: this error originates in the macro `::juniper::sa::assert_type_ne_all` which comes from the expansion of the derive macro `GraphQLUnion` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::string::String: GraphQLObject<__S>` is not satisfied
--> fail/union/enum_same_type_ugly.rs:5:7
|
5 | A(std::string::String),
| ^^^^^^^^^^^^^^^^^^^ the trait `GraphQLObject<__S>` is not implemented for `std::string::String`
|
= help: the following other types implement trait `GraphQLObject<S>`:
<Box<T> as GraphQLObject<S>>
<juniper::meta::Field<'a, S> as GraphQLObject<S>>
<Argument<'a, S> as GraphQLObject<S>>
<EnumValue as GraphQLObject<__S>>
<SchemaType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::TypeType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::DirectiveType<'a, S> as GraphQLObject<S>>
<Arc<T> as GraphQLObject<S>>
<&T as GraphQLObject<S>>
error[E0277]: the trait bound `std::string::String: GraphQLObject<__S>` is not satisfied
--> fail/union/enum_same_type_ugly.rs:6:7
|
6 | B(String),
| ^^^^^^ the trait `GraphQLObject<__S>` is not implemented for `std::string::String`
|
= help: the following other types implement trait `GraphQLObject<S>`:
<Box<T> as GraphQLObject<S>>
<juniper::meta::Field<'a, S> as GraphQLObject<S>>
<Argument<'a, S> as GraphQLObject<S>>
<EnumValue as GraphQLObject<__S>>
<SchemaType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::TypeType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::DirectiveType<'a, S> as GraphQLObject<S>>
<Arc<T> as GraphQLObject<S>>
<&T as GraphQLObject<S>>

View file

@ -8,3 +8,37 @@ error[E0119]: conflicting implementations of trait `MutuallyExclusive` for type
| conflicting implementation for `std::string::String`
|
= note: this error originates in the macro `::juniper::sa::assert_type_ne_all` which comes from the expansion of the derive macro `GraphQLUnion` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::string::String: GraphQLObject<__S>` is not satisfied
--> fail/union/struct_same_type_ugly.rs:5:14
|
5 | #[graphql(on std::string::String = Character::b)]
| ^^^^^^^^^^^^^^^^^^^ the trait `GraphQLObject<__S>` is not implemented for `std::string::String`
|
= help: the following other types implement trait `GraphQLObject<S>`:
<Box<T> as GraphQLObject<S>>
<juniper::meta::Field<'a, S> as GraphQLObject<S>>
<Argument<'a, S> as GraphQLObject<S>>
<EnumValue as GraphQLObject<__S>>
<SchemaType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::TypeType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::DirectiveType<'a, S> as GraphQLObject<S>>
<Arc<T> as GraphQLObject<S>>
<&T as GraphQLObject<S>>
error[E0277]: the trait bound `std::string::String: GraphQLObject<__S>` is not satisfied
--> fail/union/struct_same_type_ugly.rs:4:14
|
4 | #[graphql(on String = Character::a)]
| ^^^^^^ the trait `GraphQLObject<__S>` is not implemented for `std::string::String`
|
= help: the following other types implement trait `GraphQLObject<S>`:
<Box<T> as GraphQLObject<S>>
<juniper::meta::Field<'a, S> as GraphQLObject<S>>
<Argument<'a, S> as GraphQLObject<S>>
<EnumValue as GraphQLObject<__S>>
<SchemaType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::TypeType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::DirectiveType<'a, S> as GraphQLObject<S>>
<Arc<T> as GraphQLObject<S>>
<&T as GraphQLObject<S>>

View file

@ -8,3 +8,37 @@ error[E0119]: conflicting implementations of trait `MutuallyExclusive` for type
| conflicting implementation for `std::string::String`
|
= note: this error originates in the macro `::juniper::sa::assert_type_ne_all` which comes from the expansion of the attribute macro `graphql_union` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `std::string::String: GraphQLObject<__S>` is not satisfied
--> fail/union/trait_same_type_ugly.rs:5:28
|
5 | fn a(&self) -> Option<&String>;
| ^^^^^^ the trait `GraphQLObject<__S>` is not implemented for `std::string::String`
|
= help: the following other types implement trait `GraphQLObject<S>`:
<Box<T> as GraphQLObject<S>>
<juniper::meta::Field<'a, S> as GraphQLObject<S>>
<Argument<'a, S> as GraphQLObject<S>>
<EnumValue as GraphQLObject<__S>>
<SchemaType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::TypeType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::DirectiveType<'a, S> as GraphQLObject<S>>
<Arc<T> as GraphQLObject<S>>
<&T as GraphQLObject<S>>
error[E0277]: the trait bound `std::string::String: GraphQLObject<__S>` is not satisfied
--> fail/union/trait_same_type_ugly.rs:6:28
|
6 | fn b(&self) -> Option<&std::string::String>;
| ^^^^^^^^^^^^^^^^^^^ the trait `GraphQLObject<__S>` is not implemented for `std::string::String`
|
= help: the following other types implement trait `GraphQLObject<S>`:
<Box<T> as GraphQLObject<S>>
<juniper::meta::Field<'a, S> as GraphQLObject<S>>
<Argument<'a, S> as GraphQLObject<S>>
<EnumValue as GraphQLObject<__S>>
<SchemaType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::TypeType<'a, S> as GraphQLObject<S>>
<juniper::schema::model::DirectiveType<'a, S> as GraphQLObject<S>>
<Arc<T> as GraphQLObject<S>>
<&T as GraphQLObject<S>>

View file

@ -1,5 +1,6 @@
//! Tests for `#[graphql_interface]` macro placed on a trait.
#![allow(dead_code)]
// Assert that `#[graphql_interface]` macro placed on a trait stops Clippy from enforcing `# Errors`
// and `# Panics` sections in GraphQL descriptions.
#![deny(clippy::missing_errors_doc, clippy::missing_panics_doc)]

View file

@ -998,6 +998,7 @@ mod inferred_custom_context {
mod ignored_method {
use super::*;
#[allow(dead_code)]
#[graphql_union]
trait Character {
fn as_human(&self) -> prelude::Option<&Human> {
@ -1180,6 +1181,7 @@ mod full_featured {
use super::*;
/// Rust doc.
#[allow(dead_code)]
#[graphql_union(name = "MyChar")]
#[graphql_union(description = "My character.")]
#[graphql_union(context = CustomContext, scalar = DefaultScalarValue)]

View file

@ -8,6 +8,7 @@ use juniper::{
struct Query;
#[allow(dead_code)]
#[graphql_interface(for = [Human, Droid])]
trait Character {
fn id(&self) -> &str;

View file

@ -6,6 +6,7 @@ use juniper::{
EmptySubscription, GraphQLObject, GraphQLUnion, RootNode,
};
#[allow(dead_code)]
#[graphql_interface(for = [Human, Droid])]
trait Character {
fn id(&self) -> &str;

View file

@ -24,6 +24,7 @@ impl Query {
}
}
#[allow(dead_code)]
#[graphql_interface(for = [Human, Droid])]
trait Character {
fn id(&self) -> i32;