Skip to content

Commit eb39e28

Browse files
committed
cargo fix --edition-idioms
1 parent a7952d6 commit eb39e28

File tree

19 files changed

+75
-75
lines changed

19 files changed

+75
-75
lines changed

graphql_client/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#![deny(warnings)]
66
#![deny(missing_docs)]
77

8-
extern crate serde;
8+
use serde;
99
#[macro_use]
1010
extern crate serde_derive;
11-
pub extern crate graphql_query_derive;
11+
pub use graphql_query_derive;
1212

1313
#[cfg_attr(test, macro_use)]
14-
extern crate serde_json;
14+
use serde_json;
1515

1616
#[doc(hidden)]
1717
pub use graphql_query_derive::*;
@@ -111,7 +111,7 @@ pub enum PathFragment {
111111
}
112112

113113
impl Display for PathFragment {
114-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
114+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
115115
match *self {
116116
PathFragment::Key(ref key) => write!(f, "{}", key),
117117
PathFragment::Index(ref idx) => write!(f, "{}", idx),
@@ -200,7 +200,7 @@ pub struct Error {
200200
}
201201

202202
impl Display for Error {
203-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
203+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
204204
// Use `/` as a separator like JSON Pointer.
205205
let path = self
206206
.path

graphql_client/tests/alias.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#[macro_use]
22
extern crate graphql_client;
3-
extern crate serde;
3+
44
#[macro_use]
55
extern crate serde_derive;
66
#[macro_use]

graphql_client/tests/scalar_variables.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
extern crate graphql_client;
33
#[macro_use]
44
extern crate serde_derive;
5-
extern crate serde;
6-
extern crate serde_json;
5+
6+
use serde_json;
77

88
#[derive(GraphQLQuery)]
99
#[graphql(

graphql_client_codegen/src/codegen.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pub(crate) fn select_operation<'query>(
2020
.map(|i| i.to_owned())
2121
}
2222

23-
pub(crate) fn all_operations(query: &query::Document) -> Vec<Operation> {
24-
let mut operations: Vec<Operation> = Vec::new();
23+
pub(crate) fn all_operations(query: &query::Document) -> Vec<Operation<'_>> {
24+
let mut operations: Vec<Operation<'_>> = Vec::new();
2525

2626
for definition in &query.definitions {
2727
if let query::Definition::Operation(op) = definition {
@@ -33,9 +33,9 @@ pub(crate) fn all_operations(query: &query::Document) -> Vec<Operation> {
3333

3434
/// The main code generation function.
3535
pub(crate) fn response_for_query(
36-
schema: &schema::Schema,
36+
schema: &schema::Schema<'_>,
3737
query: &query::Document,
38-
operation: &Operation,
38+
operation: &Operation<'_>,
3939
options: &crate::GraphQLClientCodegenOptions,
4040
) -> Result<TokenStream, failure::Error> {
4141
let mut context = QueryContext::new(schema, options.deprecation_strategy());

graphql_client_codegen/src/enums.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub struct GqlEnum<'schema> {
1818
}
1919

2020
impl<'schema> GqlEnum<'schema> {
21-
pub(crate) fn to_rust(&self, query_context: &crate::query::QueryContext) -> TokenStream {
21+
pub(crate) fn to_rust(&self, query_context: &crate::query::QueryContext<'_, '_>) -> TokenStream {
2222
let derives = query_context.response_enum_derives();
2323
let variant_names: Vec<TokenStream> = self
2424
.variants

graphql_client_codegen/src/field_type.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub enum FieldType<'a> {
1414

1515
impl<'a> FieldType<'a> {
1616
/// Takes a field type with its name
17-
pub(crate) fn to_rust(&self, context: &QueryContext, prefix: &str) -> TokenStream {
17+
pub(crate) fn to_rust(&self, context: &QueryContext<'_, '_>, prefix: &str) -> TokenStream {
1818
let prefix: &str = if prefix.is_empty() {
1919
self.inner_name_str()
2020
} else {
@@ -94,7 +94,7 @@ impl<'schema> ::std::convert::From<&'schema graphql_parser::schema::Type> for Fi
9494
}
9595
}
9696

97-
fn from_schema_type_inner(inner: &graphql_parser::schema::Type, non_null: bool) -> FieldType {
97+
fn from_schema_type_inner(inner: &graphql_parser::schema::Type, non_null: bool) -> FieldType<'_> {
9898
match inner {
9999
graphql_parser::schema::Type::ListType(inner) => {
100100
let inner = from_schema_type_inner(&*inner, false);
@@ -117,7 +117,7 @@ fn from_schema_type_inner(inner: &graphql_parser::schema::Type, non_null: bool)
117117
}
118118
}
119119

120-
fn from_json_type_inner(inner: &introspection_response::TypeRef, non_null: bool) -> FieldType {
120+
fn from_json_type_inner(inner: &introspection_response::TypeRef, non_null: bool) -> FieldType<'_> {
121121
use crate::introspection_response::*;
122122

123123
match inner.kind {

graphql_client_codegen/src/fragments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub(crate) struct GqlFragment<'query> {
3636

3737
impl<'query> GqlFragment<'query> {
3838
/// Generate all the Rust code required by the fragment's object selection.
39-
pub(crate) fn to_rust(&self, context: &QueryContext) -> Result<TokenStream, ::failure::Error> {
39+
pub(crate) fn to_rust(&self, context: &QueryContext<'_, '_>) -> Result<TokenStream, ::failure::Error> {
4040
match self.on {
4141
FragmentTarget::Object(obj) => {
4242
obj.response_for_selection(context, &self.selection, &self.name)

graphql_client_codegen/src/inputs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl<'schema> GqlInput<'schema> {
3030
})
3131
}
3232

33-
fn contains_type_without_indirection(&self, context: &QueryContext, type_name: &str) -> bool {
33+
fn contains_type_without_indirection(&self, context: &QueryContext<'_, '_>, type_name: &str) -> bool {
3434
// the input type is recursive if any of its members contains it, without indirection
3535
self.fields.values().any(|field| {
3636
// the field is indirected, so no boxing is needed
@@ -56,13 +56,13 @@ impl<'schema> GqlInput<'schema> {
5656
})
5757
}
5858

59-
fn is_recursive_without_indirection(&self, context: &QueryContext) -> bool {
59+
fn is_recursive_without_indirection(&self, context: &QueryContext<'_, '_>) -> bool {
6060
self.contains_type_without_indirection(context, &self.name)
6161
}
6262

63-
pub(crate) fn to_rust(&self, context: &QueryContext) -> Result<TokenStream, failure::Error> {
63+
pub(crate) fn to_rust(&self, context: &QueryContext<'_, '_>) -> Result<TokenStream, failure::Error> {
6464
let name = Ident::new(&self.name, Span::call_site());
65-
let mut fields: Vec<&GqlObjectField> = self.fields.values().collect();
65+
let mut fields: Vec<&GqlObjectField<'_>> = self.fields.values().collect();
6666
fields.sort_unstable_by(|a, b| a.name.cmp(&b.name));
6767
let fields = fields.iter().map(|field| {
6868
let ty = field.type_.to_rust(&context, "");

graphql_client_codegen/src/interfaces.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl<'schema> GqlInterface<'schema> {
3232
fn object_selection<'query>(
3333
&self,
3434
selection: &'query Selection<'query>,
35-
query_context: &QueryContext,
35+
query_context: &QueryContext<'_, '_>,
3636
) -> Selection<'query> {
3737
(&selection)
3838
.into_iter()
@@ -58,8 +58,8 @@ impl<'schema> GqlInterface<'schema> {
5858

5959
fn union_selection<'query>(
6060
&self,
61-
selection: &'query Selection,
62-
query_context: &QueryContext,
61+
selection: &'query Selection<'_>,
62+
query_context: &QueryContext<'_, '_>,
6363
) -> Selection<'query> {
6464
(&selection)
6565
.into_iter()
@@ -100,8 +100,8 @@ impl<'schema> GqlInterface<'schema> {
100100
/// The generated code for each of the selected field's types. See [shared::field_impls_for_selection].
101101
pub(crate) fn field_impls_for_selection(
102102
&self,
103-
context: &QueryContext,
104-
selection: &Selection,
103+
context: &QueryContext<'_, '_>,
104+
selection: &Selection<'_>,
105105
prefix: &str,
106106
) -> Result<Vec<TokenStream>, failure::Error> {
107107
crate::shared::field_impls_for_selection(
@@ -115,8 +115,8 @@ impl<'schema> GqlInterface<'schema> {
115115
/// The code for the interface's corresponding struct's fields.
116116
pub(crate) fn response_fields_for_selection(
117117
&self,
118-
context: &QueryContext,
119-
selection: &Selection,
118+
context: &QueryContext<'_, '_>,
119+
selection: &Selection<'_>,
120120
prefix: &str,
121121
) -> Result<Vec<TokenStream>, failure::Error> {
122122
response_fields_for_selection(
@@ -131,8 +131,8 @@ impl<'schema> GqlInterface<'schema> {
131131
/// Generate all the code for the interface.
132132
pub(crate) fn response_for_selection(
133133
&self,
134-
query_context: &QueryContext,
135-
selection: &Selection,
134+
query_context: &QueryContext<'_, '_>,
135+
selection: &Selection<'_>,
136136
prefix: &str,
137137
) -> Result<TokenStream, failure::Error> {
138138
let name = Ident::new(&prefix, Span::call_site());
@@ -250,7 +250,7 @@ mod tests {
250250
name: "__typename",
251251
fields: Selection::new_empty(),
252252
});
253-
let selection: Selection = vec![typename_field].into_iter().collect();
253+
let selection: Selection<'_> = vec![typename_field].into_iter().collect();
254254

255255
assert_eq!(
256256
iface.object_selection(&selection, &context),

graphql_client_codegen/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
88
#[macro_use]
99
extern crate failure;
10-
extern crate graphql_parser;
11-
extern crate heck;
10+
use graphql_parser;
11+
1212
#[macro_use]
1313
extern crate lazy_static;
14-
extern crate proc_macro;
15-
extern crate proc_macro2;
16-
extern crate serde;
14+
15+
use proc_macro2;
16+
use serde;
1717
#[macro_use]
1818
extern crate serde_derive;
19-
extern crate serde_json;
20-
extern crate syn;
19+
20+
2121
#[macro_use]
2222
extern crate quote;
2323

0 commit comments

Comments
 (0)