@@ -181,8 +181,6 @@ fn push_actual_errors(
181181 . filter ( |( _, span) | Path :: new ( & span. file_name ) == Path :: new ( & file_name) )
182182 . collect ( ) ;
183183
184- let spans_in_this_file: Vec < _ > = spans_info_in_this_file. iter ( ) . map ( |( _, span) | span) . collect ( ) ;
185-
186184 let primary_spans: Vec < _ > = spans_info_in_this_file
187185 . iter ( )
188186 . filter ( |( is_primary, _) | * is_primary)
@@ -280,7 +278,9 @@ fn push_actual_errors(
280278 line_num : Some ( span. line_start + index) ,
281279 kind : ErrorKind :: Suggestion ,
282280 msg : line. to_string ( ) ,
283- require_annotation : true ,
281+ // Empty suggestions (suggestions to remove something) are common
282+ // and annotating them in source is not useful.
283+ require_annotation : !line. is_empty ( ) ,
284284 } ) ;
285285 }
286286 }
@@ -294,13 +294,16 @@ fn push_actual_errors(
294294 }
295295
296296 // Add notes for any labels that appear in the message.
297- for span in spans_in_this_file. iter ( ) . filter ( |span| span. label . is_some ( ) ) {
298- errors. push ( Error {
299- line_num : Some ( span. line_start ) ,
300- kind : ErrorKind :: Note ,
301- msg : span. label . clone ( ) . unwrap ( ) ,
302- require_annotation : true ,
303- } ) ;
297+ for ( _, span) in spans_info_in_this_file {
298+ if let Some ( label) = & span. label {
299+ errors. push ( Error {
300+ line_num : Some ( span. line_start ) ,
301+ kind : ErrorKind :: Note ,
302+ msg : label. clone ( ) ,
303+ // Empty labels (only underlining spans) are common and do not need annotations.
304+ require_annotation : !label. is_empty ( ) ,
305+ } ) ;
306+ }
304307 }
305308
306309 // Flatten out the children.
0 commit comments