File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -738,7 +738,17 @@ fn rustfix_and_fix(
738
738
// As mentioned above in `rustfix_crate`, we don't immediately warn
739
739
// about suggestions that fail to apply here, and instead we save them
740
740
// off for later processing.
741
+ let mut already_applied = HashSet :: new ( ) ;
741
742
for suggestion in suggestions. iter ( ) . rev ( ) {
743
+ // Skip seemly duplicate suggestions.
744
+ if suggestion
745
+ . solutions
746
+ . iter ( )
747
+ . any ( |sol| !already_applied. insert ( sol) )
748
+ {
749
+ // already applied
750
+ break ;
751
+ }
742
752
match fixed. apply ( suggestion) {
743
753
Ok ( ( ) ) => fixed_file. fixes_applied += 1 ,
744
754
Err ( e) => fixed_file. errors_applying_fixes . push ( e. to_string ( ) ) ,
Original file line number Diff line number Diff line change @@ -1924,21 +1924,21 @@ fn fix_only_once_for_duplicates() {
1924
1924
. build ( ) ;
1925
1925
1926
1926
p. cargo ( "fix --allow-no-vcs" )
1927
- . with_stderr_contains (
1927
+ . with_stderr (
1928
1928
"\
1929
1929
[CHECKING] foo v0.0.1 ([CWD])
1930
- [FIXED] src/lib.rs (2 fixes)
1930
+ [FIXED] src/lib.rs (1 fix)
1931
+ [FINISHED] `dev` profile [..]
1931
1932
" ,
1932
1933
)
1933
- . with_stderr_contains ( "[WARNING] unnecessary `unsafe` block[..]" )
1934
1934
. run ( ) ;
1935
1935
1936
1936
assert_eq ! (
1937
1937
p. read_file( "src/lib.rs" ) . matches( "unsafe" ) . count( ) ,
1938
- 5 ,
1938
+ 4 ,
1939
1939
"unsafe keyword in src/lib.rs:\n \
1940
1940
2 in lint name;\n \
1941
1941
1 from original unsafe fn;\n \
1942
- 2 from newly-applied unsafe blocks"
1942
+ 1 from newly-applied unsafe blocks"
1943
1943
) ;
1944
1944
}
You can’t perform that action at this time.
0 commit comments