Skip to content

Commit bd72a04

Browse files
committed
Fix a bunch of compiler warnings
1 parent 2024a4f commit bd72a04

File tree

4 files changed

+47
-17
lines changed

4 files changed

+47
-17
lines changed

examples/github/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ use graphql_query::*;
1414
struct Query1;
1515

1616
fn main() -> Result<(), failure::Error> {
17-
let q = Query1::build_query(query1::Variables);
17+
let _q = Query1::build_query(query1::Variables);
1818
Ok(())
1919
}

graphql_query_derive/src/introspection_response.rs

Lines changed: 41 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_camel_case_types)]
2+
13
use serde;
24

35
struct IntrospectionQuery;
@@ -139,156 +141,179 @@ pub struct FullType {
139141
inputFields: Option<Vec<Option<FullTypeInputFields>>>,
140142
interfaces: Option<Vec<Option<FullTypeInterfaces>>>,
141143
enumValues: Option<Vec<Option<FullTypeEnumValues>>>,
142-
possibleTypes: Option<Vec<Option<FullTypePossibleTypes>>>,
144+
possible_types: Option<Vec<Option<FullTypePossibleTypes>>>,
143145
}
144146

145147
#[derive(Debug, Deserialize)]
148+
#[serde(rename_all = "camelCase")]
146149
pub struct FullTypeFieldsArgs {
147150
#[serde(flatten)]
148151
input_value: InputValue,
149152
}
150153

151154
#[derive(Debug, Deserialize)]
155+
#[serde(rename_all = "camelCase")]
152156
pub struct FullTypeFieldsType {
153157
#[serde(flatten)]
154158
type_ref: TypeRef,
155159
}
156160

157161
#[derive(Debug, Deserialize)]
162+
#[serde(rename_all = "camelCase")]
158163
pub struct FullTypeFields {
159164
name: Option<String>,
160165
description: Option<String>,
161166
args: Option<Vec<Option<FullTypeFieldsArgs>>>,
162167
#[serde(rename = "type")]
163168
type_: Option<FullTypeFieldsType>,
164-
isDeprecated: Option<Boolean>,
169+
is_deprecated: Option<Boolean>,
165170
deprecationReason: Option<String>,
166171
}
167172

168173
#[derive(Debug, Deserialize)]
174+
#[serde(rename_all = "camelCase")]
169175
pub struct FullTypeInputFields {
170176
#[serde(flatten)]
171177
input_value: InputValue,
172178
}
173179

174180
#[derive(Debug, Deserialize)]
181+
#[serde(rename_all = "camelCase")]
175182
pub struct FullTypeInterfaces {
176183
#[serde(flatten)]
177184
type_ref: TypeRef,
178185
}
179186

180187
#[derive(Debug, Deserialize)]
188+
#[serde(rename_all = "camelCase")]
181189
pub struct FullTypeEnumValues {
182190
name: Option<String>,
183191
description: Option<String>,
184-
isDeprecated: Option<Boolean>,
185-
deprecationReason: Option<String>,
192+
is_deprecated: Option<Boolean>,
193+
deprecation_reason: Option<String>,
186194
}
187195

188196
#[derive(Debug, Deserialize)]
197+
#[serde(rename_all = "camelCase")]
189198
pub struct FullTypePossibleTypes {
190199
#[serde(flatten)]
191200
type_ref: TypeRef,
192201
}
193202

194203
#[derive(Debug, Deserialize)]
204+
#[serde(rename_all = "camelCase")]
195205
pub struct InputValue {
196206
name: Option<String>,
197207
description: Option<String>,
198208
#[serde(rename = "type")]
199209
type_: Option<InputValueType>,
200-
defaultValue: Option<String>,
210+
default_value: Option<String>,
201211
}
202212

203213
#[derive(Debug, Deserialize)]
214+
#[serde(rename_all = "camelCase")]
204215
pub struct InputValueType {
205216
#[serde(flatten)]
206217
type_ref: TypeRef,
207218
}
208219

209220
#[derive(Debug, Deserialize)]
221+
#[serde(rename_all = "camelCase")]
210222
pub struct TypeRef {
211223
kind: Option<__TypeKind>,
212224
name: Option<String>,
213-
ofType: Option<TypeRefOfType>,
225+
of_type: Option<TypeRefOfType>,
214226
}
215227

216228
#[derive(Debug, Deserialize)]
229+
#[serde(rename_all = "camelCase")]
217230
pub struct TypeRefOfTypeOfTypeOfTypeOfTypeOfTypeOfTypeOfType {
218231
kind: Option<__TypeKind>,
219232
name: Option<String>,
220233
}
221234

222235
#[derive(Debug, Deserialize)]
236+
#[serde(rename_all = "camelCase")]
223237
pub struct TypeRefOfTypeOfTypeOfTypeOfTypeOfTypeOfType {
224238
kind: Option<__TypeKind>,
225239
name: Option<String>,
226-
ofType: Option<TypeRefOfTypeOfTypeOfTypeOfTypeOfTypeOfTypeOfType>,
240+
of_type: Option<TypeRefOfTypeOfTypeOfTypeOfTypeOfTypeOfTypeOfType>,
227241
}
228242

229243
#[derive(Debug, Deserialize)]
244+
#[serde(rename_all = "camelCase")]
230245
pub struct TypeRefOfTypeOfTypeOfTypeOfTypeOfType {
231246
kind: Option<__TypeKind>,
232247
name: Option<String>,
233-
ofType: Option<TypeRefOfTypeOfTypeOfTypeOfTypeOfTypeOfType>,
248+
of_type: Option<TypeRefOfTypeOfTypeOfTypeOfTypeOfTypeOfType>,
234249
}
235250

236251
#[derive(Debug, Deserialize)]
252+
#[serde(rename_all = "camelCase")]
237253
pub struct TypeRefOfTypeOfTypeOfTypeOfType {
238254
kind: Option<__TypeKind>,
239255
name: Option<String>,
240-
ofType: Option<TypeRefOfTypeOfTypeOfTypeOfTypeOfType>,
256+
of_type: Option<TypeRefOfTypeOfTypeOfTypeOfTypeOfType>,
241257
}
242258

243259
#[derive(Debug, Deserialize)]
260+
#[serde(rename_all = "camelCase")]
244261
pub struct TypeRefOfTypeOfTypeOfType {
245262
kind: Option<__TypeKind>,
246263
name: Option<String>,
247-
ofType: Option<TypeRefOfTypeOfTypeOfTypeOfType>,
264+
of_type: Option<TypeRefOfTypeOfTypeOfTypeOfType>,
248265
}
249266

250267
#[derive(Debug, Deserialize)]
268+
#[serde(rename_all = "camelCase")]
251269
pub struct TypeRefOfTypeOfType {
252270
kind: Option<__TypeKind>,
253271
name: Option<String>,
254-
ofType: Option<TypeRefOfTypeOfTypeOfType>,
272+
of_type: Option<TypeRefOfTypeOfTypeOfType>,
255273
}
256274

257275
#[derive(Debug, Deserialize)]
276+
#[serde(rename_all = "camelCase")]
258277
pub struct TypeRefOfType {
259278
kind: Option<__TypeKind>,
260279
name: Option<String>,
261-
ofType: Option<TypeRefOfTypeOfType>,
280+
of_type: Option<TypeRefOfTypeOfType>,
262281
}
263282

264283
#[derive(Debug, Deserialize)]
284+
#[serde(rename_all = "camelCase")]
265285
pub struct RustIntrospectionQuerySchemaQueryType {
266286
name: Option<String>,
267287
}
268288

269289
#[derive(Debug, Deserialize)]
290+
#[serde(rename_all = "camelCase")]
270291
pub struct RustIntrospectionQuerySchemaMutationType {
271292
name: Option<String>,
272293
}
273294

274295
#[derive(Debug, Deserialize)]
296+
#[serde(rename_all = "camelCase")]
275297
pub struct RustIntrospectionQuerySchemaSubscriptionType {
276298
name: Option<String>,
277299
}
278300

279301
#[derive(Debug, Deserialize)]
302+
#[serde(rename_all = "camelCase")]
280303
pub struct RustIntrospectionQuerySchemaTypes {
281304
#[serde(flatten)]
282305
full_type: FullType,
283306
}
284307

285308
#[derive(Debug, Deserialize)]
309+
#[serde(rename_all = "camelCase")]
286310
pub struct RustIntrospectionQuerySchemaDirectivesArgs {
287311
#[serde(flatten)]
288312
input_value: InputValue,
289313
}
290314

291315
#[derive(Debug, Deserialize)]
316+
#[serde(rename_all = "camelCase")]
292317
pub struct RustIntrospectionQuerySchemaDirectives {
293318
name: Option<String>,
294319
description: Option<String>,
@@ -297,10 +322,11 @@ pub struct RustIntrospectionQuerySchemaDirectives {
297322
}
298323

299324
#[derive(Debug, Deserialize)]
325+
#[serde(rename_all = "camelCase")]
300326
pub struct RustIntrospectionQuerySchema {
301-
queryType: Option<RustIntrospectionQuerySchemaQueryType>,
302-
mutationType: Option<RustIntrospectionQuerySchemaMutationType>,
303-
subscriptionType: Option<RustIntrospectionQuerySchemaSubscriptionType>,
327+
query_type: Option<RustIntrospectionQuerySchemaQueryType>,
328+
mutation_type: Option<RustIntrospectionQuerySchemaMutationType>,
329+
subscription_type: Option<RustIntrospectionQuerySchemaSubscriptionType>,
304330
types: Option<Vec<Option<RustIntrospectionQuerySchemaTypes>>>,
305331
directives: Option<Vec<Option<RustIntrospectionQuerySchemaDirectives>>>,
306332
}

graphql_query_derive/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ fn impl_gql_query(input: &syn::DeriveInput) -> Result<TokenStream, failure::Erro
6767

6868
let result = quote!(
6969
mod #module_name {
70+
#![allow(non_camel_case_types)]
71+
#![allow(non_snake_case)]
72+
#![allow(dead_code)]
73+
7074
pub const QUERY: &'static str = #query_string;
7175

7276
#schema_output

graphql_query_derive/src/unions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use graphql_parser::query;
2-
use proc_macro2::{Ident, Span, TokenStream};
2+
use proc_macro2::TokenStream;
33
use query::QueryContext;
44

55
#[derive(Debug)]

0 commit comments

Comments
 (0)