Skip to content

Commit 55a43fe

Browse files
chore(rustfmt): run cargo fmt
1 parent 1bd8e92 commit 55a43fe

File tree

6 files changed

+45
-34
lines changed

6 files changed

+45
-34
lines changed

examples/github/examples/github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn main() -> Result<(), anyhow::Error> {
4545
let variables = repo_view::Variables {
4646
owner: owner.to_string(),
4747
name: name.to_string(),
48-
with_issues: true
48+
with_issues: true,
4949
};
5050

5151
let client = Client::builder()

graphql_client_codegen/src/codegen.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,11 @@ fn render_variable_field_type(
202202
decorate_type(&full_name, &variable.r#type.qualifiers, false)
203203
}
204204

205-
fn decorate_type(ident: &Ident, qualifiers: &[GraphqlTypeQualifier], skip_or_include: bool) -> TokenStream {
205+
fn decorate_type(
206+
ident: &Ident,
207+
qualifiers: &[GraphqlTypeQualifier],
208+
skip_or_include: bool,
209+
) -> TokenStream {
206210
let mut qualified = quote!(#ident);
207211

208212
let mut non_null = false;

graphql_client_codegen/src/codegen/selection.rs

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ fn calculate_custom_response_type_selection<'a>(
8282
flatten: false,
8383
boxed: false,
8484
deprecation: field.deprecation(),
85-
skip_or_include: false
85+
skip_or_include: false,
8686
});
8787

8888
let struct_id = context.push_type(ExpandedType {
@@ -92,7 +92,7 @@ fn calculate_custom_response_type_selection<'a>(
9292
name: custom_response_type.as_str(),
9393
struct_id,
9494
boxed: false,
95-
has_skip_or_include: false
95+
has_skip_or_include: false,
9696
});
9797
}
9898

@@ -151,7 +151,10 @@ impl<'a> VariantSelection<'a> {
151151
None
152152
} else {
153153
// The selection is on one of the variants of the type.
154-
Some(VariantSelection::FragmentSpread((*fragment_id, fragment), *has_skip_or_include))
154+
Some(VariantSelection::FragmentSpread(
155+
(*fragment_id, fragment),
156+
*has_skip_or_include,
157+
))
155158
}
156159
}
157160
Selection::Field(_) | Selection::Typename => None,
@@ -184,7 +187,7 @@ fn calculate_selection<'a>(
184187
name: &fragment.name,
185188
struct_id,
186189
boxed: fragment_is_recursive(*fragment_id, context.query.query),
187-
has_skip_or_include: *has_skip_or_include
190+
has_skip_or_include: *has_skip_or_include,
188191
});
189192
return;
190193
}
@@ -255,14 +258,16 @@ fn calculate_selection<'a>(
255258
let struct_id = context.push_type(expanded_type);
256259

257260
if variant_selections.len() == 1 {
258-
if let VariantSelection::FragmentSpread((fragment_id, fragment), has_skip_or_include) =
259-
variant_selections[0].2
261+
if let VariantSelection::FragmentSpread(
262+
(fragment_id, fragment),
263+
has_skip_or_include,
264+
) = variant_selections[0].2
260265
{
261266
context.push_type_alias(TypeAlias {
262267
boxed: fragment_is_recursive(fragment_id, context.query.query),
263268
name: &fragment.name,
264269
struct_id,
265-
has_skip_or_include
270+
has_skip_or_include,
266271
});
267272
continue;
268273
}
@@ -279,18 +284,20 @@ fn calculate_selection<'a>(
279284
options,
280285
);
281286
}
282-
VariantSelection::FragmentSpread((fragment_id, fragment), has_skip_or_include) => context
283-
.push_field(ExpandedField {
284-
field_type: fragment.name.as_str().into(),
285-
field_type_qualifiers: &[GraphqlTypeQualifier::Required],
286-
flatten: true,
287-
graphql_name: None,
288-
rust_name: fragment.name.to_snake_case().into(),
289-
struct_id,
290-
deprecation: None,
291-
boxed: fragment_is_recursive(*fragment_id, context.query.query),
292-
skip_or_include: *has_skip_or_include
293-
}),
287+
VariantSelection::FragmentSpread(
288+
(fragment_id, fragment),
289+
has_skip_or_include,
290+
) => context.push_field(ExpandedField {
291+
field_type: fragment.name.as_str().into(),
292+
field_type_qualifiers: &[GraphqlTypeQualifier::Required],
293+
flatten: true,
294+
graphql_name: None,
295+
rust_name: fragment.name.to_snake_case().into(),
296+
struct_id,
297+
deprecation: None,
298+
boxed: fragment_is_recursive(*fragment_id, context.query.query),
299+
skip_or_include: *has_skip_or_include,
300+
}),
294301
}
295302
}
296303
} else {
@@ -336,7 +343,7 @@ fn calculate_selection<'a>(
336343
flatten: false,
337344
deprecation: schema_field.deprecation(),
338345
boxed: false,
339-
skip_or_include: field.skip_or_include
346+
skip_or_include: field.skip_or_include,
340347
});
341348
}
342349
TypeId::Scalar(scalar) => {
@@ -354,7 +361,7 @@ fn calculate_selection<'a>(
354361
flatten: false,
355362
deprecation: schema_field.deprecation(),
356363
boxed: false,
357-
skip_or_include: field.skip_or_include
364+
skip_or_include: field.skip_or_include,
358365
});
359366
}
360367
TypeId::Object(_) | TypeId::Interface(_) | TypeId::Union(_) => {
@@ -369,7 +376,7 @@ fn calculate_selection<'a>(
369376
flatten: false,
370377
boxed: false,
371378
deprecation: schema_field.deprecation(),
372-
skip_or_include: field.skip_or_include
379+
skip_or_include: field.skip_or_include,
373380
});
374381

375382
let type_id = context.push_type(ExpandedType {
@@ -415,7 +422,7 @@ fn calculate_selection<'a>(
415422
flatten: true,
416423
deprecation: None,
417424
boxed: fragment_is_recursive(*fragment_id, context.query.query),
418-
skip_or_include: *has_skip_or_include
425+
skip_or_include: *has_skip_or_include,
419426
});
420427

421428
// We stop here, because the structs for the fragments are generated separately, to
@@ -432,7 +439,7 @@ struct TypeAlias<'a> {
432439
name: &'a str,
433440
struct_id: ResponseTypeId,
434441
boxed: bool,
435-
has_skip_or_include: bool
442+
has_skip_or_include: bool,
436443
}
437444

438445
struct ExpandedField<'a> {
@@ -444,7 +451,7 @@ struct ExpandedField<'a> {
444451
flatten: bool,
445452
deprecation: Option<Option<&'a str>>,
446453
boxed: bool,
447-
skip_or_include: bool
454+
skip_or_include: bool,
448455
}
449456

450457
impl ExpandedField<'_> {
@@ -453,7 +460,7 @@ impl ExpandedField<'_> {
453460
let qualified_type = decorate_type(
454461
&Ident::new(&self.field_type, Span::call_site()),
455462
self.field_type_qualifiers,
456-
self.skip_or_include
463+
self.skip_or_include,
457464
);
458465

459466
let qualified_type = if self.boxed {

graphql_client_codegen/src/query/selection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ pub(crate) struct SelectedField {
257257
pub(crate) alias: Option<String>,
258258
pub(crate) field_id: StoredFieldId,
259259
pub(crate) selection_set: Vec<SelectionId>,
260-
pub(crate) skip_or_include: bool
260+
pub(crate) skip_or_include: bool,
261261
}
262262

263263
impl SelectedField {

graphql_client_codegen/src/schema/graphql_parser_conversion.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn ingest_object<'doc, T>(
184184
name: field.name.as_ref().into(),
185185
r#type: resolve_field_type(schema, &field.field_type),
186186
parent: super::StoredFieldParent::Object(object_id),
187-
deprecation: find_deprecation(&field.directives)
187+
deprecation: find_deprecation(&field.directives),
188188
};
189189

190190
field_ids.push(schema.push_field(field));
@@ -221,7 +221,7 @@ fn ingest_object_type_extension<'doc, T>(
221221
name: field.name.as_ref().into(),
222222
r#type: resolve_field_type(schema, &field.field_type),
223223
parent: super::StoredFieldParent::Object(object_id),
224-
deprecation: find_deprecation(&field.directives)
224+
deprecation: find_deprecation(&field.directives),
225225
};
226226

227227
field_ids.push(schema.push_field(field));
@@ -290,7 +290,7 @@ fn ingest_interface<'doc, T>(
290290
name: field.name.as_ref().into(),
291291
r#type: resolve_field_type(schema, &field.field_type),
292292
parent: super::StoredFieldParent::Interface(interface_id),
293-
deprecation: find_deprecation(&field.directives)
293+
deprecation: find_deprecation(&field.directives),
294294
};
295295

296296
field_ids.push(schema.push_field(field));

graphql_client_codegen/src/schema/json_conversion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ fn ingest_interface(schema: &mut Schema, iface: &mut FullType) {
183183
Some(field.deprecation_reason.clone())
184184
} else {
185185
None
186-
}
186+
},
187187
};
188188

189189
field_ids.push(schema.push_field(field));
@@ -218,7 +218,7 @@ fn ingest_object(schema: &mut Schema, object: &mut FullType) {
218218
Some(field.deprecation_reason.clone())
219219
} else {
220220
None
221-
}
221+
},
222222
};
223223

224224
field_ids.push(schema.push_field(field));

0 commit comments

Comments
 (0)