File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -402,18 +402,18 @@ fn rustfix_and_fix(
402
402
// Make sure we've got a file associated with this suggestion and all
403
403
// snippets point to the same file. Right now it's not clear what
404
404
// we would do with multiple files.
405
- let file_name = match suggestion. solutions . get ( 0 ) . and_then ( |sol| sol. replacements . get ( 0 ) ) {
406
- Some ( s) => s. snippet . file_name . clone ( ) ,
407
- None => {
408
- trace ! ( "rejecting as it has no solutions {:?}" , suggestion) ;
409
- continue ;
410
- }
405
+ let file_names = suggestion. solutions . iter ( )
406
+ . flat_map ( |s| s. replacements . iter ( ) )
407
+ . map ( |r| & r. snippet . file_name ) ;
408
+
409
+ let file_name = if let Some ( file_name) = file_names. clone ( ) . next ( ) {
410
+ file_name. clone ( )
411
+ } else {
412
+ trace ! ( "rejecting as it has no solutions {:?}" , suggestion) ;
413
+ continue ;
411
414
} ;
412
- if !suggestion
413
- . solutions
414
- . iter ( )
415
- . all ( |sol| sol. replacements . iter ( ) . all ( |rep| rep. snippet . file_name == file_name) )
416
- {
415
+
416
+ if !file_names. clone ( ) . all ( |f| f == & file_name) {
417
417
trace ! ( "rejecting as it changes multiple files: {:?}" , suggestion) ;
418
418
continue ;
419
419
}
You can’t perform that action at this time.
0 commit comments