Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #14092 - Alexendoo:rustfix-separate-suggestions, r=weih…
…anglo Add `CodeFix::apply_solution` and impl `Clone` ### What does this PR try to resolve? In Clippy we have a good few lints that produce mutually exclusive suggestions e.g. ``` error: octal-looking escape in a literal --> tests/ui/octal_escapes.rs:6:19 | LL | let _bad2 = b"\033[0m"; | ^^^^ | help: if an octal escape is intended, use a hex escape instead | LL | let _bad2 = b"\x1b[0m"; | ~~~~ help: if a null escape is intended, disambiguate using | LL | let _bad2 = b"\x0033[0m"; | ~~~~~~ ``` For these we have to disable rustfix tests since the suggestions are overlapping, this PR adds a method to `rustfix` that `ui_test` could use in order to produce multiple `.fixed` files, one for each alternative suggestion ### Additional information It does not work for for multiple suggestions coming from a single subdiagnostic ([`Diag::span_suggestions`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/diagnostic/struct.Diag.html#method.span_suggestions)) e.g. ``` help: consider importing one of these items | 1 + use std::collections::HashMap; | 1 + use ahash::HashMap; ``` Solving this would be blocked on rust-lang/rust#53934, on the Clippy side we only have one use of `span_suggestions` however so it's still very useful without this The test cases use Clippy lints that I generated by setting the `parse_and_replace` test to use `clippy-driver` because of familiarity, if there's a rustc case that does multiple suggestions it would be good to go with that
- Loading branch information