Skip to content

Commit 2488aa1

Browse files
committed
More rustfmt
1 parent 68d051c commit 2488aa1

File tree

9 files changed

+26
-21
lines changed

9 files changed

+26
-21
lines changed

wundergraph_cli/src/print_schema/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use infer_schema_internals::*;
22
use std::error::Error;
33

4-
54
mod print_helper;
65
use self::print_helper::*;
76

wundergraph_derive/src/filter.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ pub fn derive(item: &syn::DeriveInput) -> Result<TokenStream, Diagnostic> {
6262
let remote_type = inner_ty_arg(&f.ty, "HasMany", 0).expect("It is HasMany");
6363
quote!(<<#remote_type as diesel::associations::BelongsTo<#item_name>>::ForeignKeyColumn as diesel::Column>::Table)
6464
});
65-
let foreign_key = f.foreign_key()
65+
let foreign_key = f
66+
.foreign_key()
6667
.map(|k| quote!(#remote_table::#k))
6768
.unwrap_or_else(|_| {
6869
let remote_type = inner_ty_arg(&f.ty, "HasMany", 0).expect("It is HasMany");

wundergraph_derive/src/filter_value.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use diagnostic_shim::Diagnostic;
2-
use proc_macro2::{TokenStream, Span};
2+
use proc_macro2::{Span, TokenStream};
33
use syn;
44
use utils::wrap_in_dummy_mod;
55

wundergraph_derive/src/meta.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use proc_macro2::{Span, TokenTree, Ident};
1+
use proc_macro2::{Ident, Span, TokenTree};
22
use syn;
33
use syn::fold::Fold;
44
use syn::spanned::Spanned;
@@ -26,9 +26,8 @@ impl MetaItem {
2626
}
2727

2828
pub fn get_deprecated(attrs: &[syn::Attribute]) -> Option<String> {
29-
Self::with_name(attrs, "deprecated").and_then(|d|{
30-
d.nested_item("note").and_then(|n| n.str_value()).ok()
31-
})
29+
Self::with_name(attrs, "deprecated")
30+
.and_then(|d| d.nested_item("note").and_then(|n| n.str_value()).ok())
3231
}
3332

3433
pub fn get_docs(attrs: &[syn::Attribute]) -> Option<String> {
@@ -144,7 +143,8 @@ impl MetaItem {
144143

145144
match self.meta {
146145
List(ref list) => Ok(Nested(list.nested.iter())),
147-
_ => Err(self.span()
146+
_ => Err(self
147+
.span()
148148
.error(format!("`{0}` must be in the form `{0}(...)`", self.name()))),
149149
}
150150
}
@@ -196,7 +196,8 @@ impl MetaItem {
196196
Ok(x) => x,
197197
Err(_) => return,
198198
};
199-
let unrecognized_options = nested.filter(|n| !options.contains(&(&n.name().to_string() as _)));
199+
let unrecognized_options =
200+
nested.filter(|n| !options.contains(&(&n.name().to_string() as _)));
200201
for ignored in unrecognized_options {
201202
ignored
202203
.span()

wundergraph_derive/src/model.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ impl Model {
120120
));
121121
}
122122
} else {
123-
return Err(span.error(
124-
"Context type needs exactly one generic argument called Conn",
125-
));
123+
return Err(span
124+
.error("Context type needs exactly one generic argument called Conn"));
126125
}
127126
} else {
128127
return Err(span.error("Invalid context type"));

wundergraph_derive/src/nameable.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
use diagnostic_shim::Diagnostic;
2-
use proc_macro2::{TokenStream, Span};
2+
use proc_macro2::{Span, TokenStream};
33
use syn;
44
use utils::wrap_in_dummy_mod;
55

66
pub fn derive(item: &syn::DeriveInput) -> Result<TokenStream, Diagnostic> {
77
let item_name = &item.ident;
88
let (impl_generics, ty_generics, where_clause) = item.generics.split_for_impl();
99

10-
let dummy_mod = format!("_impl_nameable_for_{}", item.ident.to_string().to_lowercase());
10+
let dummy_mod = format!(
11+
"_impl_nameable_for_{}",
12+
item.ident.to_string().to_lowercase()
13+
);
1114
Ok(wrap_in_dummy_mod(
1215
&syn::Ident::new(&dummy_mod, Span::call_site()),
1316
&quote! {

wundergraph_derive/src/utils.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ pub fn inner_ty_arg<'a>(ty: &'a Type, type_name: &str, index: usize) -> Option<&
6666

6767
match *ty {
6868
Type::Path(ref ty) => {
69-
let last_segment = ty.path
69+
let last_segment = ty
70+
.path
7071
.segments
7172
.iter()
7273
.last()
@@ -88,7 +89,8 @@ pub fn inner_ty_arg<'a>(ty: &'a Type, type_name: &str, index: usize) -> Option<&
8889
pub fn ty_name(ty: &Type) -> Option<&Ident> {
8990
match *ty {
9091
Type::Path(ref ty) => {
91-
let last_segment = ty.path
92+
let last_segment = ty
93+
.path
9294
.segments
9395
.iter()
9496
.last()

wundergraph_derive/src/wundergraph_entity.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ fn handle_has_one(
247247
let child_ty = inner_of_option_ty(child_ty);
248248
let id_ty = inner_ty_arg(&f.ty, "HasOne", 0).expect("Is HasOne, so this exists");
249249
let field_access = field_name.access();
250-
let table = f.remote_table()
250+
let table = f
251+
.remote_table()
251252
.map(|t| quote!(#t::table))
252253
.unwrap_or_else(|_| {
253254
let remote_type = inner_of_option_ty(

wundergraph_example/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ pub struct AppearsIn {
149149
episode: Episode,
150150
}
151151

152-
#[derive(Clone, Debug, Queryable, Eq, PartialEq, Hash, WundergraphEntity,
153-
WundergraphFilter, Associations)]
152+
#[derive(Clone, Debug, Queryable, Eq, PartialEq, Hash, WundergraphEntity, WundergraphFilter,
153+
Associations)]
154154
#[table_name = "friends"]
155155
#[belongs_to(Hero)]
156156
#[wundergraph(context = "MyContext<Conn>")]
@@ -175,7 +175,7 @@ impl<'a> Identifiable for &'a Friend {
175175
fn id(self) -> Self::Id {
176176
let friend_id = match self.friend_id {
177177
HasOne::Id(ref id) => id,
178-
HasOne::Item(ref hero) => &hero.id
178+
HasOne::Item(ref hero) => &hero.id,
179179
};
180180
(&self.hero_id, friend_id)
181181
}
@@ -267,7 +267,6 @@ mod hero {
267267
}
268268
pub use self::hero::{Hero, HeroFilter};
269269

270-
271270
#[derive(Clone, Debug, Identifiable, Hash, Eq, PartialEq, Queryable, WundergraphEntity,
272271
WundergraphFilter)]
273272
#[table_name = "species"]

0 commit comments

Comments
 (0)