@@ -367,7 +367,8 @@ impl EmitterWriter {
367367 & source_string[ margin. left ( line_len) ..margin. right ( line_len) ] ,
368368 Style :: Quotation ,
369369 ) ;
370- if margin. was_cut_left ( ) { // We have stripped some code/whitespace from the beginning, make it clear.
370+ if margin. was_cut_left ( ) {
371+ // We have stripped some code/whitespace from the beginning, make it clear.
371372 buffer. puts ( line_offset, code_offset, "..." , Style :: LineNumber ) ;
372373 }
373374 if margin. was_cut_right ( line_len) {
@@ -403,7 +404,7 @@ impl EmitterWriter {
403404 // ^^ ^ ^^^ ^^^^ ^^^ we don't care about code too far to the right of a span, we trim it
404405 // | | | |
405406 // | | | actual code found in your source code and the spans we use to mark it
406- // | | when there's too much wasted space to the left, we trim it to focus where it matters
407+ // | | when there's too much wasted space to the left, trim it
407408 // | vertical divider between the column number and the code
408409 // column number
409410
@@ -1251,18 +1252,16 @@ impl EmitterWriter {
12511252 let mut label_right_margin = 0 ;
12521253 let mut max_line_len = 0 ;
12531254 for line in & annotated_file. lines {
1254- max_line_len = max (
1255- max_line_len ,
1256- annotated_file . file . get_line ( line . line_index - 1 ) . map ( |s| s. len ( ) ) . unwrap_or ( 0 ) ,
1257- ) ;
1255+ max_line_len = max ( max_line_len , annotated_file . file
1256+ . get_line ( line . line_index - 1 )
1257+ . map ( |s| s. len ( ) )
1258+ . unwrap_or ( 0 ) ) ;
12581259 for ann in & line. annotations {
12591260 span_right_margin = max ( span_right_margin, ann. start_col ) ;
12601261 span_right_margin = max ( span_right_margin, ann. end_col ) ;
1261- label_right_margin = max (
1262- label_right_margin,
1263- // TODO: account for labels not in the same line
1264- ann. end_col + ann. label . as_ref ( ) . map ( |l| l. len ( ) + 1 ) . unwrap_or ( 0 ) ,
1265- ) ;
1262+ // FIXME: account for labels not in the same line
1263+ let label_right = ann. label . as_ref ( ) . map ( |l| l. len ( ) + 1 ) . unwrap_or ( 0 ) ;
1264+ label_right_margin = max ( label_right_margin, ann. end_col + label_right) ;
12661265 }
12671266 }
12681267
0 commit comments