@@ -4,8 +4,7 @@ use crate::format::{format_directives, Displayable, Formatter, Style};
4
4
5
5
use crate :: query:: ast:: * ;
6
6
7
- impl < ' a , T : Text < ' a > > Document < ' a , T >
8
- {
7
+ impl < ' a , T : Text < ' a > > Document < ' a , T > {
9
8
/// Format a document according to style
10
9
pub fn format ( & self , style : & Style ) -> String {
11
10
let mut formatter = Formatter :: new ( style) ;
@@ -21,17 +20,15 @@ fn to_string<T: Displayable>(v: &T) -> String {
21
20
formatter. into_string ( )
22
21
}
23
22
24
- impl < ' a , T : Text < ' a > > Displayable for Document < ' a , T >
25
- {
23
+ impl < ' a , T : Text < ' a > > Displayable for Document < ' a , T > {
26
24
fn display ( & self , f : & mut Formatter ) {
27
25
for item in & self . definitions {
28
26
item. display ( f) ;
29
27
}
30
28
}
31
29
}
32
30
33
- impl < ' a , T : Text < ' a > > Displayable for Definition < ' a , T >
34
- {
31
+ impl < ' a , T : Text < ' a > > Displayable for Definition < ' a , T > {
35
32
fn display ( & self , f : & mut Formatter ) {
36
33
match * self {
37
34
Definition :: Operation ( ref op) => op. display ( f) ,
@@ -40,8 +37,7 @@ impl<'a, T: Text<'a>> Displayable for Definition<'a, T>
40
37
}
41
38
}
42
39
43
- impl < ' a , T : Text < ' a > > Displayable for OperationDefinition < ' a , T >
44
- {
40
+ impl < ' a , T : Text < ' a > > Displayable for OperationDefinition < ' a , T > {
45
41
fn display ( & self , f : & mut Formatter ) {
46
42
match * self {
47
43
OperationDefinition :: SelectionSet ( ref set) => set. display ( f) ,
@@ -52,8 +48,7 @@ impl<'a, T: Text<'a>> Displayable for OperationDefinition<'a, T>
52
48
}
53
49
}
54
50
55
- impl < ' a , T : Text < ' a > > Displayable for FragmentDefinition < ' a , T >
56
- {
51
+ impl < ' a , T : Text < ' a > > Displayable for FragmentDefinition < ' a , T > {
57
52
fn display ( & self , f : & mut Formatter ) {
58
53
f. margin ( ) ;
59
54
f. indent ( ) ;
@@ -71,8 +66,7 @@ impl<'a, T: Text<'a>> Displayable for FragmentDefinition<'a, T>
71
66
}
72
67
}
73
68
74
- impl < ' a , T : Text < ' a > > Displayable for SelectionSet < ' a , T >
75
- {
69
+ impl < ' a , T : Text < ' a > > Displayable for SelectionSet < ' a , T > {
76
70
fn display ( & self , f : & mut Formatter ) {
77
71
f. margin ( ) ;
78
72
f. indent ( ) ;
@@ -84,8 +78,7 @@ impl<'a, T: Text<'a>> Displayable for SelectionSet<'a, T>
84
78
}
85
79
}
86
80
87
- impl < ' a , T : Text < ' a > > Displayable for Selection < ' a , T >
88
- {
81
+ impl < ' a , T : Text < ' a > > Displayable for Selection < ' a , T > {
89
82
fn display ( & self , f : & mut Formatter ) {
90
83
match * self {
91
84
Selection :: Field ( ref fld) => fld. display ( f) ,
@@ -95,8 +88,7 @@ impl<'a, T: Text<'a>> Displayable for Selection<'a, T>
95
88
}
96
89
}
97
90
98
- fn format_arguments < ' a , T : Text < ' a > > ( arguments : & [ ( T :: Value , Value < ' a , T > ) ] , f : & mut Formatter )
99
- {
91
+ fn format_arguments < ' a , T : Text < ' a > > ( arguments : & [ ( T :: Value , Value < ' a , T > ) ] , f : & mut Formatter ) {
100
92
if !arguments. is_empty ( ) {
101
93
f. start_argument_block ( '(' ) ;
102
94
f. start_argument ( ) ;
@@ -114,8 +106,7 @@ fn format_arguments<'a, T: Text<'a>>(arguments: &[(T::Value, Value<'a, T>)], f:
114
106
}
115
107
}
116
108
117
- impl < ' a , T : Text < ' a > > Displayable for Field < ' a , T >
118
- {
109
+ impl < ' a , T : Text < ' a > > Displayable for Field < ' a , T > {
119
110
fn display ( & self , f : & mut Formatter ) {
120
111
f. indent ( ) ;
121
112
if let Some ( ref alias) = self . alias {
@@ -138,8 +129,7 @@ impl<'a, T: Text<'a>> Displayable for Field<'a, T>
138
129
}
139
130
}
140
131
141
- impl < ' a , T : Text < ' a > > Displayable for Query < ' a , T >
142
- {
132
+ impl < ' a , T : Text < ' a > > Displayable for Query < ' a , T > {
143
133
fn display ( & self , f : & mut Formatter ) {
144
134
f. margin ( ) ;
145
135
f. indent ( ) ;
@@ -167,8 +157,7 @@ impl<'a, T: Text<'a>> Displayable for Query<'a, T>
167
157
}
168
158
}
169
159
170
- impl < ' a , T : Text < ' a > > Displayable for Mutation < ' a , T >
171
- {
160
+ impl < ' a , T : Text < ' a > > Displayable for Mutation < ' a , T > {
172
161
fn display ( & self , f : & mut Formatter ) {
173
162
f. margin ( ) ;
174
163
f. indent ( ) ;
@@ -196,8 +185,7 @@ impl<'a, T: Text<'a>> Displayable for Mutation<'a, T>
196
185
}
197
186
}
198
187
199
- impl < ' a , T : Text < ' a > > Displayable for Subscription < ' a , T >
200
- {
188
+ impl < ' a , T : Text < ' a > > Displayable for Subscription < ' a , T > {
201
189
fn display ( & self , f : & mut Formatter ) {
202
190
f. margin ( ) ;
203
191
f. indent ( ) ;
@@ -223,8 +211,7 @@ impl<'a, T: Text<'a>> Displayable for Subscription<'a, T>
223
211
}
224
212
}
225
213
226
- impl < ' a , T : Text < ' a > > Displayable for VariableDefinition < ' a , T >
227
- {
214
+ impl < ' a , T : Text < ' a > > Displayable for VariableDefinition < ' a , T > {
228
215
fn display ( & self , f : & mut Formatter ) {
229
216
f. write ( "$" ) ;
230
217
f. write ( self . name . as_ref ( ) ) ;
@@ -237,8 +224,7 @@ impl<'a, T: Text<'a>> Displayable for VariableDefinition<'a, T>
237
224
}
238
225
}
239
226
240
- impl < ' a , T : Text < ' a > > Displayable for Type < ' a , T >
241
- {
227
+ impl < ' a , T : Text < ' a > > Displayable for Type < ' a , T > {
242
228
fn display ( & self , f : & mut Formatter ) {
243
229
match * self {
244
230
Type :: NamedType ( ref name) => f. write ( name. as_ref ( ) ) ,
@@ -255,8 +241,7 @@ impl<'a, T: Text<'a>> Displayable for Type<'a, T>
255
241
}
256
242
}
257
243
258
- impl < ' a , T : Text < ' a > > Displayable for Value < ' a , T >
259
- {
244
+ impl < ' a , T : Text < ' a > > Displayable for Value < ' a , T > {
260
245
fn display ( & self , f : & mut Formatter ) {
261
246
match * self {
262
247
Value :: Variable ( ref name) => {
@@ -303,8 +288,7 @@ impl<'a, T: Text<'a>> Displayable for Value<'a, T>
303
288
}
304
289
}
305
290
306
- impl < ' a , T : Text < ' a > > Displayable for InlineFragment < ' a , T >
307
- {
291
+ impl < ' a , T : Text < ' a > > Displayable for InlineFragment < ' a , T > {
308
292
fn display ( & self , f : & mut Formatter ) {
309
293
f. indent ( ) ;
310
294
f. write ( "..." ) ;
@@ -322,8 +306,7 @@ impl<'a, T: Text<'a>> Displayable for InlineFragment<'a, T>
322
306
}
323
307
}
324
308
325
- impl < ' a , T : Text < ' a > > Displayable for TypeCondition < ' a , T >
326
- {
309
+ impl < ' a , T : Text < ' a > > Displayable for TypeCondition < ' a , T > {
327
310
fn display ( & self , f : & mut Formatter ) {
328
311
match * self {
329
312
TypeCondition :: On ( ref name) => {
@@ -334,8 +317,7 @@ impl<'a, T: Text<'a>> Displayable for TypeCondition<'a, T>
334
317
}
335
318
}
336
319
337
- impl < ' a , T : Text < ' a > > Displayable for FragmentSpread < ' a , T >
338
- {
320
+ impl < ' a , T : Text < ' a > > Displayable for FragmentSpread < ' a , T > {
339
321
fn display ( & self , f : & mut Formatter ) {
340
322
f. indent ( ) ;
341
323
f. write ( "..." ) ;
@@ -345,8 +327,7 @@ impl<'a, T: Text<'a>> Displayable for FragmentSpread<'a, T>
345
327
}
346
328
}
347
329
348
- impl < ' a , T : Text < ' a > > Displayable for Directive < ' a , T >
349
- {
330
+ impl < ' a , T : Text < ' a > > Displayable for Directive < ' a , T > {
350
331
fn display ( & self , f : & mut Formatter ) {
351
332
f. write ( "@" ) ;
352
333
f. write ( self . name . as_ref ( ) ) ;
0 commit comments