Clean up test warnings (#392)

This commit is contained in:
Christian Legnitto 2019-07-15 21:47:16 -07:00 committed by GitHub
parent 85fec1ca94
commit 7bedea05ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

View file

@ -14,7 +14,7 @@ mod interface {
}
}
graphql_interface!(<'a> &'a Pet: () as "Pet" |&self| {
graphql_interface!(<'a> &'a dyn Pet: () as "Pet" |&self| {
field name() -> &str { self.name() }
instance_resolvers: |&_| {
@ -38,7 +38,7 @@ mod interface {
}
#[crate::object_internal(
interfaces = [&Pet]
interfaces = [&dyn Pet]
)]
impl Dog {
fn name(&self) -> &str {
@ -64,7 +64,7 @@ mod interface {
}
#[crate::object_internal(
interfaces = [&Pet]
interfaces = [&dyn Pet]
)]
impl Cat {
fn name(&self) -> &str {
@ -76,12 +76,12 @@ mod interface {
}
struct Schema {
pets: Vec<Box<Pet>>,
pets: Vec<Box<dyn Pet>>,
}
#[crate::object_internal]
impl Schema {
fn pets(&self) -> Vec<&Pet> {
fn pets(&self) -> Vec<&dyn Pet> {
self.pets.iter().map(|p| p.as_ref()).collect()
}
}
@ -170,7 +170,7 @@ mod union {
}
}
graphql_union!(<'a> &'a Pet: () as "Pet" |&self| {
graphql_union!(<'a> &'a dyn Pet: () as "Pet" |&self| {
instance_resolvers: |&_| {
&Dog => self.as_dog(),
&Cat => self.as_cat(),
@ -220,12 +220,12 @@ mod union {
}
struct Schema {
pets: Vec<Box<Pet>>,
pets: Vec<Box<dyn Pet>>,
}
#[crate::object_internal]
impl Schema {
fn pets(&self) -> Vec<&Pet> {
fn pets(&self) -> Vec<&dyn Pet> {
self.pets.iter().map(|p| p.as_ref()).collect()
}
}

View file

@ -20,7 +20,7 @@ impl syn::parse::Parse for TransparentAttributes {
description: None,
};
let mut content;
let content;
syn::parenthesized!(content in input);
while !content.is_empty() {

View file

@ -307,7 +307,7 @@ impl syn::parse::Parse for ObjectAttributes {
// Skip potential parantheses which are present for regular attributes but not for proc macro
// attributes.
let inner = (|| {
let mut content;
let content;
syn::parenthesized!(content in input);
Ok(content)
})();
@ -348,7 +348,7 @@ impl syn::parse::Parse for ObjectAttributes {
}
"interfaces" => {
input.parse::<syn::Token![=]>()?;
let mut content;
let content;
syn::bracketed!(content in input);
output.interfaces =
syn::punctuated::Punctuated::<syn::Type, syn::Token![,]>::parse_terminated(
@ -407,7 +407,7 @@ impl parse::Parse for FieldAttributeArgument {
description: None,
};
let mut content;
let content;
syn::parenthesized!(content in input);
while !content.is_empty() {
@ -485,7 +485,7 @@ impl parse::Parse for FieldAttribute {
}
"skip" => Ok(FieldAttribute::Skip(ident)),
"arguments" => {
let mut arg_content;
let arg_content;
syn::parenthesized!(arg_content in input);
let args = Punctuated::<FieldAttributeArgument, Token![,]>::parse_terminated(
&arg_content,
@ -515,7 +515,7 @@ pub struct FieldAttributes {
impl parse::Parse for FieldAttributes {
fn parse(input: syn::parse::ParseStream) -> syn::parse::Result<Self> {
// Remove wrapping parantheses.
let mut content;
let content;
syn::parenthesized!(content in input);
let items = Punctuated::<FieldAttribute, Token![,]>::parse_terminated(&content)?;