@@ -61,7 +61,8 @@ pub struct DebugStruct<'a, 'b: 'a> {
61
61
has_fields : bool ,
62
62
}
63
63
64
- pub fn debug_struct_new < ' a , ' b > ( fmt : & ' a mut fmt:: Formatter < ' b > , name : & str )
64
+ pub fn debug_struct_new < ' a , ' b > ( fmt : & ' a mut fmt:: Formatter < ' b > ,
65
+ name : & str )
65
66
-> DebugStruct < ' a , ' b > {
66
67
let result = fmt. write_str ( name) ;
67
68
DebugStruct {
@@ -84,7 +85,8 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> {
84
85
85
86
if self . is_pretty ( ) {
86
87
let mut writer = PadAdapter :: new ( self . fmt ) ;
87
- fmt:: write ( & mut writer, format_args ! ( "{}\n {}: {:#?}" , prefix, name, value) )
88
+ fmt:: write ( & mut writer,
89
+ format_args ! ( "{}\n {}: {:#?}" , prefix, name, value) )
88
90
} else {
89
91
write ! ( self . fmt, "{} {}: {:?}" , prefix, name, value)
90
92
}
@@ -195,10 +197,18 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
195
197
self . result = self . result . and_then ( |_| {
196
198
if self . is_pretty ( ) {
197
199
let mut writer = PadAdapter :: new ( self . fmt ) ;
198
- let prefix = if self . has_fields { "," } else { "" } ;
200
+ let prefix = if self . has_fields {
201
+ ","
202
+ } else {
203
+ ""
204
+ } ;
199
205
fmt:: write ( & mut writer, format_args ! ( "{}\n {:#?}" , prefix, entry) )
200
206
} else {
201
- let prefix = if self . has_fields { ", " } else { "" } ;
207
+ let prefix = if self . has_fields {
208
+ ", "
209
+ } else {
210
+ ""
211
+ } ;
202
212
write ! ( self . fmt, "{}{:?}" , prefix, entry)
203
213
}
204
214
} ) ;
@@ -207,7 +217,11 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> {
207
217
}
208
218
209
219
pub fn finish ( & mut self ) {
210
- let prefix = if self . is_pretty ( ) && self . has_fields { "\n " } else { "" } ;
220
+ let prefix = if self . is_pretty ( ) && self . has_fields {
221
+ "\n "
222
+ } else {
223
+ ""
224
+ } ;
211
225
self . result = self . result . and_then ( |_| self . fmt . write_str ( prefix) ) ;
212
226
}
213
227
@@ -232,7 +246,7 @@ pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b
232
246
fmt : fmt,
233
247
result : result,
234
248
has_fields : false ,
235
- }
249
+ } ,
236
250
}
237
251
}
238
252
@@ -247,7 +261,9 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> {
247
261
/// Adds the contents of an iterator of entries to the set output.
248
262
#[ stable( feature = "debug_builders" , since = "1.2.0" ) ]
249
263
pub fn entries < D , I > ( & mut self , entries : I ) -> & mut DebugSet < ' a , ' b >
250
- where D : fmt:: Debug , I : IntoIterator < Item =D > {
264
+ where D : fmt:: Debug ,
265
+ I : IntoIterator < Item = D >
266
+ {
251
267
for entry in entries {
252
268
self . entry ( & entry) ;
253
269
}
@@ -278,7 +294,7 @@ pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a,
278
294
fmt : fmt,
279
295
result : result,
280
296
has_fields : false ,
281
- }
297
+ } ,
282
298
}
283
299
}
284
300
@@ -293,7 +309,9 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> {
293
309
/// Adds the contents of an iterator of entries to the list output.
294
310
#[ stable( feature = "debug_builders" , since = "1.2.0" ) ]
295
311
pub fn entries < D , I > ( & mut self , entries : I ) -> & mut DebugList < ' a , ' b >
296
- where D : fmt:: Debug , I : IntoIterator < Item =D > {
312
+ where D : fmt:: Debug ,
313
+ I : IntoIterator < Item = D >
314
+ {
297
315
for entry in entries {
298
316
self . entry ( & entry) ;
299
317
}
@@ -335,10 +353,19 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
335
353
self . result = self . result . and_then ( |_| {
336
354
if self . is_pretty ( ) {
337
355
let mut writer = PadAdapter :: new ( self . fmt ) ;
338
- let prefix = if self . has_fields { "," } else { "" } ;
339
- fmt:: write ( & mut writer, format_args ! ( "{}\n {:#?}: {:#?}" , prefix, key, value) )
356
+ let prefix = if self . has_fields {
357
+ ","
358
+ } else {
359
+ ""
360
+ } ;
361
+ fmt:: write ( & mut writer,
362
+ format_args ! ( "{}\n {:#?}: {:#?}" , prefix, key, value) )
340
363
} else {
341
- let prefix = if self . has_fields { ", " } else { "" } ;
364
+ let prefix = if self . has_fields {
365
+ ", "
366
+ } else {
367
+ ""
368
+ } ;
342
369
write ! ( self . fmt, "{}{:?}: {:?}" , prefix, key, value)
343
370
}
344
371
} ) ;
@@ -350,7 +377,10 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
350
377
/// Adds the contents of an iterator of entries to the map output.
351
378
#[ stable( feature = "debug_builders" , since = "1.2.0" ) ]
352
379
pub fn entries < K , V , I > ( & mut self , entries : I ) -> & mut DebugMap < ' a , ' b >
353
- where K : fmt:: Debug , V : fmt:: Debug , I : IntoIterator < Item =( K , V ) > {
380
+ where K : fmt:: Debug ,
381
+ V : fmt:: Debug ,
382
+ I : IntoIterator < Item = ( K , V ) >
383
+ {
354
384
for ( k, v) in entries {
355
385
self . entry ( & k, & v) ;
356
386
}
@@ -360,7 +390,11 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> {
360
390
/// Finishes output and returns any error encountered.
361
391
#[ stable( feature = "debug_builders" , since = "1.2.0" ) ]
362
392
pub fn finish ( & mut self ) -> fmt:: Result {
363
- let prefix = if self . is_pretty ( ) && self . has_fields { "\n " } else { "" } ;
393
+ let prefix = if self . is_pretty ( ) && self . has_fields {
394
+ "\n "
395
+ } else {
396
+ ""
397
+ } ;
364
398
self . result . and_then ( |_| write ! ( self . fmt, "{}}}" , prefix) )
365
399
}
366
400
0 commit comments