Satisfy rust_2018_idioms
rustc lint in generated code
This commit is contained in:
parent
1f0f683d0b
commit
d6f5cee8b3
12 changed files with 40 additions and 38 deletions
|
@ -696,8 +696,8 @@ impl Definition {
|
|||
&self,
|
||||
info: &Self::TypeInfo,
|
||||
field: &str,
|
||||
args: &::juniper::Arguments<#scalar>,
|
||||
executor: &::juniper::Executor<Self::Context, #scalar>,
|
||||
args: &::juniper::Arguments<'_, #scalar>,
|
||||
executor: &::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::ExecutionResult<#scalar> {
|
||||
match field {
|
||||
#( #fields_resolvers )*
|
||||
|
@ -717,8 +717,8 @@ impl Definition {
|
|||
&self,
|
||||
info: &Self::TypeInfo,
|
||||
type_name: &str,
|
||||
_: Option<&[::juniper::Selection<#scalar>]>,
|
||||
executor: &::juniper::Executor<Self::Context, #scalar>,
|
||||
_: Option<&[::juniper::Selection<'_, #scalar>]>,
|
||||
executor: &::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::ExecutionResult<#scalar> {
|
||||
#downcast
|
||||
}
|
||||
|
@ -767,8 +767,8 @@ impl Definition {
|
|||
&'b self,
|
||||
info: &'b Self::TypeInfo,
|
||||
field: &'b str,
|
||||
args: &'b ::juniper::Arguments<#scalar>,
|
||||
executor: &'b ::juniper::Executor<Self::Context, #scalar>,
|
||||
args: &'b ::juniper::Arguments<'_, #scalar>,
|
||||
executor: &'b ::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::BoxFuture<'b, ::juniper::ExecutionResult<#scalar>> {
|
||||
match field {
|
||||
#( #fields_resolvers )*
|
||||
|
@ -962,8 +962,8 @@ impl Definition {
|
|||
fn call(
|
||||
&self,
|
||||
info: &Self::TypeInfo,
|
||||
args: &::juniper::Arguments<#scalar>,
|
||||
executor: &::juniper::Executor<Self::Context, #scalar>,
|
||||
args: &::juniper::Arguments<'_, #scalar>,
|
||||
executor: &::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::ExecutionResult<#scalar> {
|
||||
match self {
|
||||
#( #ty::#implemented_for_idents(v) => {
|
||||
|
@ -1042,8 +1042,8 @@ impl Definition {
|
|||
fn call<'b>(
|
||||
&'b self,
|
||||
info: &'b Self::TypeInfo,
|
||||
args: &'b ::juniper::Arguments<#scalar>,
|
||||
executor: &'b ::juniper::Executor<Self::Context, #scalar>,
|
||||
args: &'b ::juniper::Arguments<'_, #scalar>,
|
||||
executor: &'b ::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::BoxFuture<'b, ::juniper::ExecutionResult<#scalar>> {
|
||||
match self {
|
||||
#( #ty::#implemented_for_idents(v) => {
|
||||
|
|
|
@ -679,8 +679,8 @@ impl Definition<Query> {
|
|||
fn call(
|
||||
&self,
|
||||
info: &Self::TypeInfo,
|
||||
args: &::juniper::Arguments<#scalar>,
|
||||
executor: &::juniper::Executor<Self::Context, #scalar>,
|
||||
args: &::juniper::Arguments<'_, #scalar>,
|
||||
executor: &::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::ExecutionResult<#scalar> {
|
||||
#resolve
|
||||
}
|
||||
|
@ -740,8 +740,8 @@ impl Definition<Query> {
|
|||
fn call<'b>(
|
||||
&'b self,
|
||||
info: &'b Self::TypeInfo,
|
||||
args: &'b ::juniper::Arguments<#scalar>,
|
||||
executor: &'b ::juniper::Executor<Self::Context, #scalar>,
|
||||
args: &'b ::juniper::Arguments<'_, #scalar>,
|
||||
executor: &'b ::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::BoxFuture<'b, ::juniper::ExecutionResult<#scalar>> {
|
||||
let fut = #res;
|
||||
#resolving_code
|
||||
|
@ -799,8 +799,8 @@ impl Definition<Query> {
|
|||
&self,
|
||||
info: &Self::TypeInfo,
|
||||
field: &str,
|
||||
args: &::juniper::Arguments<#scalar>,
|
||||
executor: &::juniper::Executor<Self::Context, #scalar>,
|
||||
args: &::juniper::Arguments<'_, #scalar>,
|
||||
executor: &::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::ExecutionResult<#scalar> {
|
||||
match field {
|
||||
#( #fields_resolvers )*
|
||||
|
@ -856,8 +856,8 @@ impl Definition<Query> {
|
|||
&'b self,
|
||||
info: &'b Self::TypeInfo,
|
||||
field: &'b str,
|
||||
args: &'b ::juniper::Arguments<#scalar>,
|
||||
executor: &'b ::juniper::Executor<Self::Context, #scalar>,
|
||||
args: &'b ::juniper::Arguments<'_, #scalar>,
|
||||
executor: &'b ::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::BoxFuture<'b, ::juniper::ExecutionResult<#scalar>> {
|
||||
match field {
|
||||
#( #fields_resolvers )*
|
||||
|
|
|
@ -432,8 +432,8 @@ impl Definition {
|
|||
fn resolve(
|
||||
&self,
|
||||
info: &(),
|
||||
selection: Option<&[::juniper::Selection<#scalar>]>,
|
||||
executor: &::juniper::Executor<Self::Context, #scalar>,
|
||||
selection: Option<&[::juniper::Selection<'_, #scalar>]>,
|
||||
executor: &::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::ExecutionResult<#scalar> {
|
||||
#resolve
|
||||
}
|
||||
|
@ -460,8 +460,8 @@ impl Definition {
|
|||
fn resolve_async<'b>(
|
||||
&'b self,
|
||||
info: &'b Self::TypeInfo,
|
||||
selection_set: Option<&'b [::juniper::Selection<#scalar>]>,
|
||||
executor: &'b ::juniper::Executor<Self::Context, #scalar>,
|
||||
selection_set: Option<&'b [::juniper::Selection<'_, #scalar>]>,
|
||||
executor: &'b ::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::BoxFuture<'b, ::juniper::ExecutionResult<#scalar>> {
|
||||
use ::juniper::futures::future;
|
||||
let v = ::juniper::GraphQLValue::resolve(self, info, selection_set, executor);
|
||||
|
|
|
@ -57,8 +57,8 @@ impl Definition<Subscription> {
|
|||
&self,
|
||||
_: &Self::TypeInfo,
|
||||
_: &str,
|
||||
_: &::juniper::Arguments<#scalar>,
|
||||
_: &::juniper::Executor<Self::Context, #scalar>,
|
||||
_: &::juniper::Arguments<'_, #scalar>,
|
||||
_: &::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::ExecutionResult<#scalar> {
|
||||
Err(::juniper::FieldError::from(
|
||||
"Called `resolve_field` on subscription object",
|
||||
|
|
|
@ -554,8 +554,8 @@ impl Definition {
|
|||
&self,
|
||||
info: &Self::TypeInfo,
|
||||
type_name: &str,
|
||||
_: Option<&[::juniper::Selection<#scalar>]>,
|
||||
executor: &::juniper::Executor<Self::Context, #scalar>,
|
||||
_: Option<&[::juniper::Selection<'_, #scalar>]>,
|
||||
executor: &::juniper::Executor<'_, '_, Self::Context, #scalar>,
|
||||
) -> ::juniper::ExecutionResult<#scalar> {
|
||||
let context = executor.context();
|
||||
#( #variant_resolvers )*
|
||||
|
|
|
@ -65,7 +65,7 @@ fn test_derived_enum() {
|
|||
);
|
||||
|
||||
// Ensure validity of meta info.
|
||||
let mut registry: Registry = Registry::new(FnvHashMap::default());
|
||||
let mut registry: Registry<'_> = Registry::new(FnvHashMap::default());
|
||||
let meta = SomeEnum::meta(&(), &mut registry);
|
||||
|
||||
assert_eq!(meta.name(), Some("Some"));
|
||||
|
@ -100,21 +100,21 @@ fn test_derived_enum() {
|
|||
|
||||
#[test]
|
||||
fn test_doc_comment() {
|
||||
let mut registry: Registry = Registry::new(FnvHashMap::default());
|
||||
let mut registry: Registry<'_> = Registry::new(FnvHashMap::default());
|
||||
let meta = DocEnum::meta(&(), &mut registry);
|
||||
assert_eq!(meta.description(), Some("Enum doc."));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_doc_comment() {
|
||||
let mut registry: Registry = Registry::new(FnvHashMap::default());
|
||||
let mut registry: Registry<'_> = Registry::new(FnvHashMap::default());
|
||||
let meta = MultiDocEnum::meta(&(), &mut registry);
|
||||
assert_eq!(meta.description(), Some("Doc 1. Doc 2.\n\nDoc 4."));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_comment_override() {
|
||||
let mut registry: Registry = Registry::new(FnvHashMap::default());
|
||||
let mut registry: Registry<'_> = Registry::new(FnvHashMap::default());
|
||||
let meta = OverrideDocEnum::meta(&(), &mut registry);
|
||||
assert_eq!(meta.description(), Some("enum override"));
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ fn test_derived_input_object() {
|
|||
);
|
||||
|
||||
// Validate meta info.
|
||||
let mut registry: Registry = Registry::new(FnvHashMap::default());
|
||||
let mut registry: Registry<'_> = Registry::new(FnvHashMap::default());
|
||||
let meta = Input::meta(&(), &mut registry);
|
||||
assert_eq!(meta.name(), Some("MyInput"));
|
||||
assert_eq!(meta.description(), Some("input descr"));
|
||||
|
@ -171,21 +171,21 @@ fn test_derived_input_object() {
|
|||
|
||||
#[test]
|
||||
fn test_doc_comment() {
|
||||
let mut registry: Registry = Registry::new(FnvHashMap::default());
|
||||
let mut registry: Registry<'_> = Registry::new(FnvHashMap::default());
|
||||
let meta = DocComment::meta(&(), &mut registry);
|
||||
assert_eq!(meta.description(), Some("Object comment."));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_multi_doc_comment() {
|
||||
let mut registry: Registry = Registry::new(FnvHashMap::default());
|
||||
let mut registry: Registry<'_> = Registry::new(FnvHashMap::default());
|
||||
let meta = MultiDocComment::meta(&(), &mut registry);
|
||||
assert_eq!(meta.description(), Some("Doc 1. Doc 2.\n\nDoc 4."));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_doc_comment_override() {
|
||||
let mut registry: Registry = Registry::new(FnvHashMap::default());
|
||||
let mut registry: Registry<'_> = Registry::new(FnvHashMap::default());
|
||||
let meta = OverrideDocComment::meta(&(), &mut registry);
|
||||
assert_eq!(meta.description(), Some("obj override"));
|
||||
}
|
||||
|
|
|
@ -2569,7 +2569,7 @@ mod has_no_missing_docs {
|
|||
|
||||
#[graphql_interface(for = Human)]
|
||||
pub struct Character {
|
||||
id: String,
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
#[derive(GraphQLObject)]
|
||||
|
|
|
@ -3407,7 +3407,7 @@ mod has_no_missing_docs {
|
|||
use super::*;
|
||||
|
||||
#[graphql_interface(for = Human)]
|
||||
trait Character {
|
||||
pub trait Character {
|
||||
fn id(&self) -> &str;
|
||||
}
|
||||
|
||||
|
|
|
@ -2591,7 +2591,7 @@ mod has_no_missing_docs {
|
|||
#[derive(GraphQLInterface)]
|
||||
#[graphql(for = Human)]
|
||||
pub struct Character {
|
||||
id: String,
|
||||
pub id: String,
|
||||
}
|
||||
|
||||
#[derive(GraphQLObject)]
|
||||
|
|
|
@ -31,7 +31,7 @@ impl<'de> Deserialize<'de> for MyScalarValue {
|
|||
impl<'de> de::Visitor<'de> for Visitor {
|
||||
type Value = MyScalarValue;
|
||||
|
||||
fn expecting(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
fn expecting(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_str("a valid input value")
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#![deny(rust_2018_idioms)]
|
||||
|
||||
#[cfg(test)]
|
||||
mod arc_fields;
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in a new issue