@@ -107,13 +107,17 @@ impl Emitter for EmitterWriter {
107
107
}
108
108
109
109
fn emit_struct ( & mut self , db : & DiagnosticBuilder ) {
110
- self . emit_multispan ( db. span . as_ref ( ) , & db. message , db. code . as_ref ( ) . map ( |s| & * * s) , db. level , true ) ;
110
+ self . emit_multispan ( db. span . as_ref ( ) , & db. message ,
111
+ db. code . as_ref ( ) . map ( |s| & * * s) , db. level , true ) ;
112
+
111
113
for child in & db. children {
112
114
match child. render_span {
113
115
Some ( ref sp) =>
114
- self . emit_renderspan ( sp, & child. message , child. level ) ,
116
+ self . emit_renderspan ( sp, & child. message ,
117
+ child. level ) ,
115
118
None =>
116
- self . emit_multispan ( child. span . as_ref ( ) , & child. message , None , child. level , false ) ,
119
+ self . emit_multispan ( child. span . as_ref ( ) ,
120
+ & child. message , None , child. level , false ) ,
117
121
}
118
122
}
119
123
}
@@ -142,7 +146,8 @@ impl EmitterWriter {
142
146
let dst = Destination :: from_stderr ( ) ;
143
147
EmitterWriter { dst : dst, registry : registry, cm : code_map, first : true }
144
148
} else {
145
- EmitterWriter { dst : Raw ( Box :: new ( io:: stderr ( ) ) ) , registry : registry, cm : code_map, first : true }
149
+ EmitterWriter { dst : Raw ( Box :: new ( io:: stderr ( ) ) ) ,
150
+ registry : registry, cm : code_map, first : true }
146
151
}
147
152
}
148
153
@@ -179,8 +184,8 @@ impl EmitterWriter {
179
184
}
180
185
}
181
186
182
- fn emit_multispan ( & mut self , span : Option < & MultiSpan > , msg : & str , code : Option < & str > , lvl : Level ,
183
- is_header : bool ) {
187
+ fn emit_multispan ( & mut self , span : Option < & MultiSpan > , msg : & str ,
188
+ code : Option < & str > , lvl : Level , is_header : bool ) {
184
189
185
190
if is_header {
186
191
self . emit_header ( span) ;
@@ -209,13 +214,13 @@ impl EmitterWriter {
209
214
rsp : & RenderSpan ,
210
215
msg : & str ,
211
216
code : Option < & str > ,
212
- lvl : Level ,
217
+ lvl : Level ,
213
218
is_header : bool )
214
219
-> io:: Result < ( ) > {
215
220
let msp = rsp. span ( ) ;
216
221
let bounds = msp. primary_span ( ) ;
217
222
218
- let ss =
223
+ let ss =
219
224
if is_header {
220
225
String :: new ( )
221
226
}
@@ -225,7 +230,7 @@ impl EmitterWriter {
225
230
226
231
match code {
227
232
Some ( code) if self . registry . as_ref ( )
228
- . and_then ( |registry| registry. find_description ( code) ) . is_some ( ) =>
233
+ . and_then ( |registry| registry. find_description ( code) ) . is_some ( ) =>
229
234
{
230
235
let code_with_explain = String :: from ( "--explain " ) + code;
231
236
print_diagnostic ( & mut self . dst , & ss, lvl, msg, Some ( & code_with_explain) ) ?
@@ -363,10 +368,10 @@ fn line_num_max_digits(line: &codemap::LineInfo) -> usize {
363
368
fn print_diagnostic ( dst : & mut Destination ,
364
369
topic : & str ,
365
370
lvl : Level ,
366
- msg : & str ,
371
+ msg : & str ,
367
372
code : Option < & str > )
368
373
-> io:: Result < ( ) > {
369
-
374
+
370
375
if !topic. is_empty ( ) {
371
376
dst. start_attr ( term:: Attr :: ForegroundColor ( lvl. color ( ) ) ) ?;
372
377
write ! ( dst, "{}: " , topic) ?;
0 commit comments