mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 03:02:45 +00:00
a21997f0cc
If rustfix received a suggestion which inserts new lines without replacing existing lines, it would ignore the suggestion. This is because `parse_snippet` would immediately return if the `lines` to replace was empty. The solution here is to just drop the code which messes with the original text line. `cargo fix` (and compiletest) currently do not use this. This was originally added back in the days when rustfix supported an interactive UI which showed color highlighting of what it looks like with the replacement. My feeling is that when we add something like this back in, I would prefer to instead use a real diff library and display instead of trying to do various text manipulation for display. This particular code has generally been buggy, and has been a problem several times. The included test fails without this fix because the changes do not apply, and the code cannot compile. |
||
---|---|---|
.. | ||
.gitignore | ||
closure-immutable-outer-variable.fixed.rs | ||
closure-immutable-outer-variable.json | ||
closure-immutable-outer-variable.rs | ||
E0178.fixed.rs | ||
E0178.json | ||
E0178.rs | ||
handle-insert-only.fixed.rs | ||
handle-insert-only.json | ||
handle-insert-only.rs | ||
lt-generic-comp.fixed.rs | ||
lt-generic-comp.json | ||
lt-generic-comp.rs | ||
multiple-solutions.fixed.rs | ||
multiple-solutions.json | ||
multiple-solutions.rs | ||
replace-only-one-char.fixed.rs | ||
replace-only-one-char.json | ||
replace-only-one-char.rs | ||
str-lit-type-mismatch.fixed.rs | ||
str-lit-type-mismatch.json | ||
str-lit-type-mismatch.rs | ||
use-insert.fixed.rs | ||
use-insert.json | ||
use-insert.rs |