Skip to content

Commit 851f356

Browse files
committed
Fix warnings
1 parent b7573f1 commit 851f356

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

graphql_query_derive/src/unions.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use constants::*;
22
use failure;
3-
use heck::SnakeCase;
43
use proc_macro2::{Ident, Span, TokenStream};
54
use query::QueryContext;
65
use selection::{Selection, SelectionItem};
@@ -15,7 +14,7 @@ enum UnionError {
1514
#[fail(display = "Unknown type: {}", ty)]
1615
UnknownType { ty: String },
1716
#[fail(display = "Missing __typename in selection for {}", union_name)]
18-
MissingTypename { union_name: String }
17+
MissingTypename { union_name: String },
1918
}
2019

2120
impl GqlUnion {
@@ -37,7 +36,9 @@ impl GqlUnion {
3736
});
3837

3938
if typename_field.is_none() {
40-
Err(UnionError::MissingTypename { union_name: prefix.into() })?;
39+
Err(UnionError::MissingTypename {
40+
union_name: prefix.into(),
41+
})?;
4142
}
4243

4344
let variants: Result<Vec<TokenStream>, failure::Error> = selection
@@ -53,7 +54,7 @@ impl GqlUnion {
5354
})
5455
.map(|item| {
5556
match item {
56-
SelectionItem::Field(f) => panic!("field selection on union"),
57+
SelectionItem::Field(_) => panic!("field selection on union"),
5758
SelectionItem::FragmentSpread(_) => panic!("fragment spread on union"),
5859
SelectionItem::InlineFragment(frag) => {
5960
let variant_name = Ident::new(&frag.on, Span::call_site());
@@ -63,23 +64,23 @@ impl GqlUnion {
6364
let variant_type = Ident::new(&new_prefix, Span::call_site());
6465

6566
let field_object_type =
66-
query_context.schema.objects.get(&frag.on).map(|f| {
67+
query_context.schema.objects.get(&frag.on).map(|_f| {
6768
query_context.maybe_expand_field(
6869
&frag.on,
6970
&frag.fields,
7071
&new_prefix,
7172
)
7273
});
7374
let field_interface =
74-
query_context.schema.interfaces.get(&frag.on).map(|f| {
75+
query_context.schema.interfaces.get(&frag.on).map(|_f| {
7576
query_context.maybe_expand_field(
7677
&frag.on,
7778
&frag.fields,
7879
&new_prefix,
7980
)
8081
});
8182
// nested unions, is that even a thing?
82-
let field_union_type = query_context.schema.unions.get(&frag.on).map(|f| {
83+
let field_union_type = query_context.schema.unions.get(&frag.on).map(|_f| {
8384
query_context.maybe_expand_field(&frag.on, &frag.fields, &new_prefix)
8485
});
8586

@@ -184,7 +185,10 @@ mod tests {
184185

185186
assert!(result.is_err());
186187

187-
assert_eq!(format!("{}", result.unwrap_err()), "Missing __typename in selection for Meow");
188+
assert_eq!(
189+
format!("{}", result.unwrap_err()),
190+
"Missing __typename in selection for Meow"
191+
);
188192
}
189193

190194
#[test]
@@ -196,21 +200,17 @@ mod tests {
196200
}),
197201
SelectionItem::InlineFragment(SelectionInlineFragment {
198202
on: "User".to_string(),
199-
fields: Selection(vec![
200-
SelectionItem::Field(SelectionField {
201-
name: "first_name".to_string(),
202-
fields: Selection(vec![]),
203-
}),
204-
]),
203+
fields: Selection(vec![SelectionItem::Field(SelectionField {
204+
name: "first_name".to_string(),
205+
fields: Selection(vec![]),
206+
})]),
205207
}),
206208
SelectionItem::InlineFragment(SelectionInlineFragment {
207209
on: "Organization".to_string(),
208-
fields: Selection(vec![
209-
SelectionItem::Field(SelectionField {
210-
name: "title".to_string(),
211-
fields: Selection(vec![]),
212-
}),
213-
]),
210+
fields: Selection(vec![SelectionItem::Field(SelectionField {
211+
name: "title".to_string(),
212+
fields: Selection(vec![]),
213+
})]),
214214
}),
215215
];
216216
let mut context = QueryContext::new_empty();

0 commit comments

Comments
 (0)