Skip to content

Commit 68d051c

Browse files
committed
Run rustfmt
1 parent 0e7fc3d commit 68d051c

File tree

11 files changed

+65
-46
lines changed

11 files changed

+65
-46
lines changed

wundergraph/src/diesel_ext.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@ where
2020
T: AppearsOnTable<QS>,
2121
T: NonAggregate,
2222
T: QueryFragment<DB>,
23-
{
24-
}
23+
{}

wundergraph/src/filter/common_filter/mod.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,24 @@ where
7070
const FIELD_COUNT: usize = 3 + V::AdditionalFilter::FIELD_COUNT;
7171

7272
fn from_inner_input_value(obj: IndexMap<&str, &InputValue>) -> Option<Self> {
73-
let eq = obj.get("eq")
73+
let eq = obj
74+
.get("eq")
7475
.map(|v| Option::from_input_value(*v))
7576
.unwrap_or_else(|| Option::from_input_value(&InputValue::Null));
7677
let eq = match eq {
7778
Some(eq) => Eq::new(eq),
7879
None => return None,
7980
};
80-
let neq = obj.get("not_eq")
81+
let neq = obj
82+
.get("not_eq")
8183
.map(|v| Option::from_input_value(*v))
8284
.unwrap_or_else(|| Option::from_input_value(&InputValue::Null));
8385
let neq = match neq {
8486
Some(neq) => NotEq::new(neq),
8587
None => return None,
8688
};
87-
let eq_any = obj.get("eq_any")
89+
let eq_any = obj
90+
.get("eq_any")
8891
.map(|v| Option::from_input_value(*v))
8992
.unwrap_or_else(|| Option::from_input_value(&InputValue::Null));
9093
let eq_any = match eq_any {
@@ -104,17 +107,20 @@ where
104107
}
105108

106109
fn from_inner_look_ahead(obj: &[(&str, LookAheadValue)]) -> Self {
107-
let eq = obj.iter()
110+
let eq = obj
111+
.iter()
108112
.find(|o| o.0 == "eq")
109113
.and_then(|o| V::RawValue::from_look_ahead(&o.1));
110114
let eq = Eq::new(eq);
111115

112-
let neq = obj.iter()
116+
let neq = obj
117+
.iter()
113118
.find(|o| o.0 == "not_eq")
114119
.and_then(|o| V::RawValue::from_look_ahead(&o.1));
115120
let neq = NotEq::new(neq);
116121

117-
let eq_any = obj.iter()
122+
let eq_any = obj
123+
.iter()
118124
.find(|o| o.0 == "eq_any")
119125
.and_then(|o| Vec::from_look_ahead(&o.1));
120126
let eq_any = EqAny::new(eq_any);

wundergraph/src/filter/mod.rs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,16 @@ where
7474
{
7575
fn from_input_value(v: &InputValue) -> Option<Self> {
7676
if let Some(obj) = v.to_object_value() {
77-
let and = obj.get("and")
77+
let and = obj
78+
.get("and")
7879
.map(|v| Option::from_input_value(*v))
7980
.unwrap_or_else(|| Option::from_input_value(&InputValue::Null));
8081
let and = match and {
8182
Some(and) => and,
8283
None => return None,
8384
};
84-
let or = obj.get("or")
85+
let or = obj
86+
.get("or")
8587
.map(|v| Option::from_input_value(*v))
8688
.unwrap_or_else(|| Option::from_input_value(&InputValue::Null));
8789
let or = match or {
@@ -145,11 +147,13 @@ where
145147
{
146148
fn from_look_ahead(v: &LookAheadValue) -> Option<Self> {
147149
if let LookAheadValue::Object(ref obj) = *v {
148-
let and = obj.iter()
150+
let and = obj
151+
.iter()
149152
.find(|o| o.0 == "and")
150153
.and_then(|o| Vec::from_look_ahead(&o.1));
151154

152-
let or = obj.iter()
155+
let or = obj
156+
.iter()
153157
.find(|o| o.0 == "or")
154158
.and_then(|o| Vec::from_look_ahead(&o.1));
155159

@@ -180,18 +184,20 @@ where
180184
C: Transformator,
181185
{
182186
let Filter { and, or, inner, .. } = self;
183-
let mut and = and.map(|a| {
184-
a.into_iter().fold(AndCollector::default(), |mut a, f| {
185-
a.append_filter(f, t);
186-
a
187-
})
188-
}).unwrap_or_default();
189-
let or = or.map(|a| {
190-
a.into_iter().fold(OrCollector::default(), |mut o, f| {
191-
o.append_filter(f, t);
192-
o
193-
})
194-
}).unwrap_or_default();
187+
let mut and =
188+
and.map(|a| {
189+
a.into_iter().fold(AndCollector::default(), |mut a, f| {
190+
a.append_filter(f, t);
191+
a
192+
})
193+
}).unwrap_or_default();
194+
let or =
195+
or.map(|a| {
196+
a.into_iter().fold(OrCollector::default(), |mut o, f| {
197+
o.append_filter(f, t);
198+
o
199+
})
200+
}).unwrap_or_default();
195201
and.append_filter(or, t);
196202
and.append_filter(inner, t);
197203
and.into_filter(t)

wundergraph/src/filter/nullable_filter/filter_option.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ where
105105
}
106106

107107
fn from_inner_look_ahead(obj: &[(&str, LookAheadValue)]) -> Self {
108-
let is_null = obj.iter()
108+
let is_null = obj
109+
.iter()
109110
.find(|o| o.0 == "is_null")
110111
.and_then(|o| bool::from_look_ahead(&o.1))
111112
.map(IsNull::new);

wundergraph/src/filter/nullable_filter/reference_filter.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ where
122122
{
123123
fn from_input_value(v: &InputValue) -> Option<Self> {
124124
if let Some(obj) = v.to_object_value() {
125-
let is_null = obj.get("is_null")
125+
let is_null = obj
126+
.get("is_null")
126127
.map(|v| Option::from_input_value(*v))
127128
.unwrap_or_else(|| Option::from_input_value(&InputValue::Null));
128129
let is_null = match is_null {
@@ -159,7 +160,8 @@ where
159160
{
160161
fn from_look_ahead(v: &LookAheadValue) -> Option<Self> {
161162
if let LookAheadValue::Object(ref obj) = *v {
162-
let is_null = obj.iter()
163+
let is_null = obj
164+
.iter()
163165
.find(|o| o.0 == "is_null")
164166
.and_then(|o| bool::from_look_ahead(&o.1))
165167
.map(IsNull::new);
@@ -205,7 +207,8 @@ where
205207
const FIELD_COUNT: usize = I::FIELD_COUNT + 1;
206208

207209
fn from_inner_input_value(obj: IndexMap<&str, &InputValue>) -> Option<Self> {
208-
let is_null = obj.get("is_null")
210+
let is_null = obj
211+
.get("is_null")
209212
.map(|v| Option::from_input_value(*v))
210213
.unwrap_or_else(|| Option::from_input_value(&InputValue::Null));
211214
let is_null = match is_null {
@@ -225,7 +228,8 @@ where
225228
}
226229
fn from_inner_look_ahead(obj: &[(&str, LookAheadValue)]) -> Self {
227230
let inner = I::from_inner_look_ahead(obj);
228-
let is_null = obj.iter()
231+
let is_null = obj
232+
.iter()
229233
.find(|o| o.0 == "is_null")
230234
.and_then(|o| bool::from_look_ahead(&o.1))
231235
.map(IsNull::new);

wundergraph/src/filter/nullable_filter/reverse_reference_filter.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ where
7676
{
7777
let mut and = AndCollector::default();
7878

79-
let selective_inner = self.inner
79+
let selective_inner = self
80+
.inner
8081
.clone()
8182
.into_filter(OnlySelective)
8283
.map(|f| <_ as FilterDsl<I::Ret>>::filter(C2::Table::table(), f))
@@ -86,7 +87,8 @@ where
8687
.map(|f| Box::new(C::default().nullable().eq_any(f)) as Box<_>);
8788
and.append_filter(selective_inner, t);
8889

89-
let exclusive_inner = self.inner
90+
let exclusive_inner = self
91+
.inner
9092
.clone()
9193
.into_filter(OnlyExclusive)
9294
.map(|f| <_ as FilterDsl<I::Ret>>::filter(C2::Table::table(), f))

wundergraph/src/filter/string_filter/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ impl<C> InnerFilter for StringFilter<C> {
5858
const FIELD_COUNT: usize = 1;
5959

6060
fn from_inner_input_value(obj: IndexMap<&str, &InputValue>) -> Option<Self> {
61-
let like = obj.get("like")
61+
let like = obj
62+
.get("like")
6263
.map(|v| Option::from_input_value(*v))
6364
.unwrap_or_else(|| Option::from_input_value(&InputValue::Null));
6465
let like = match like {
@@ -69,7 +70,8 @@ impl<C> InnerFilter for StringFilter<C> {
6970
}
7071

7172
fn from_inner_look_ahead(obj: &[(&str, LookAheadValue)]) -> Self {
72-
let like = obj.iter()
73+
let like = obj
74+
.iter()
7375
.find(|o| o.0 == "like")
7476
.and_then(|o| String::from_look_ahead(&o.1));
7577
Self {

wundergraph/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ pub mod diesel_ext;
3535
pub mod error;
3636
pub mod filter;
3737
pub mod helper;
38+
#[doc(hidden)]
39+
pub mod juniper_helper;
3840
pub mod mutations;
3941
pub mod order;
4042
pub mod query_helper;
4143
pub mod query_modifier;
42-
#[doc(hidden)]
43-
pub mod juniper_helper;
4444
#[macro_use]
4545
mod macros;
4646

wundergraph/src/order.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ pub struct OrderBy {
3030
impl FromLookAheadValue for OrderBy {
3131
fn from_look_ahead(v: &LookAheadValue) -> Option<Self> {
3232
if let LookAheadValue::Object(ref obj) = *v {
33-
let column = obj.iter()
33+
let column = obj
34+
.iter()
3435
.find(|o| o.0 == "column")
3536
.and_then(|o| String::from_look_ahead(&o.1));
3637
let column = match column {
3738
Some(column) => column,
3839
None => return None,
3940
};
40-
let direction = obj.iter()
41+
let direction = obj
42+
.iter()
4143
.find(|o| o.0 == "direction")
4244
.and_then(|o| Order::from_look_ahead(&o.1));
4345
let direction = match direction {

wundergraph_bench/src/main.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ extern crate serde_json;
3535

3636
use actix::{Actor, Addr, Handler, Message, Syn, SyncArbiter, SyncContext};
3737
use actix_web::{
38-
http, server, App, AsyncResponder, FutureResponse, HttpRequest, HttpResponse, Json,
39-
State,
38+
http, server, App, AsyncResponder, FutureResponse, HttpRequest, HttpResponse, Json, State,
4039
};
4140
use diesel::pg::PgConnection;
4241
use diesel::r2d2::{ConnectionManager, Pool};
@@ -121,8 +120,8 @@ fn graphql(st: State<AppState>, data: Json<GraphQLData>) -> FutureResponse<HttpR
121120
}
122121

123122
fn main() {
124-
// env::set_var("RUST_LOG", "actix_web=info");
125-
// env_logger::init();
123+
// env::set_var("RUST_LOG", "actix_web=info");
124+
// env_logger::init();
126125
let manager = ConnectionManager::<PgConnection>::new(
127126
env::var("DATABASE_URL").expect("Database url not set"),
128127
);

wundergraph_cli/src/main.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#[macro_use]
2020
extern crate structopt;
21-
extern crate infer_schema_internals;
2221
extern crate diesel;
22+
extern crate infer_schema_internals;
2323

2424
use structopt::StructOpt;
2525

@@ -40,9 +40,7 @@ fn main() {
4040
Wundergraph::PrintSchema {
4141
database_url,
4242
schema,
43-
} => print_schema::print(
44-
&database_url,
45-
schema.as_ref().map(|s| s as &str),
46-
).expect("Failed to infer the schema"),
43+
} => print_schema::print(&database_url, schema.as_ref().map(|s| s as &str))
44+
.expect("Failed to infer the schema"),
4745
}
4846
}

0 commit comments

Comments
 (0)