Update rustfix section to new ui-test crate

This commit is contained in:
Philipp Krones 2023-08-18 19:29:00 +02:00
parent 32dc7c592d
commit 8ee6ca0981
No known key found for this signature in database
GPG Key ID: 1CA0DF2AF59D68A5

View File

@ -191,15 +191,16 @@ and prepending the `TESTNAME` variable to `cargo uitest` works for Cargo lints t
## Rustfix Tests ## Rustfix Tests
If the lint you are working on is making use of structured suggestions, the test If the lint you are working on is making use of structured suggestions,
file should include a `// run-rustfix` comment at the top. [`rustfix`] will apply the suggestions from the lint to the test file code and
compare that to the contents of a `.fixed` file.
Structured suggestions tell a user how to fix or re-write certain code that has Structured suggestions tell a user how to fix or re-write certain code that has
been linted with [`span_lint_and_sugg`]. been linted with [`span_lint_and_sugg`].
The `// run-rustfix` comment will additionally run [rustfix] for our test. Should `span_lint_and_sugg` be used to generate a suggestion, but not all
Rustfix will apply the suggestions from the lint to the test file code and suggestions lead to valid code, you can use the `//@no-rustfix` comment on top
compare that to the contents of a `.fixed` file. of the test file, to not run `rustfix` on that file.
We'll talk about suggestions more in depth in a later chapter. We'll talk about suggestions more in depth in a later chapter.
<!-- FIXME: (blyxyas) Link to "Emitting lints" when that gets merged --> <!-- FIXME: (blyxyas) Link to "Emitting lints" when that gets merged -->
@ -207,7 +208,7 @@ We'll talk about suggestions more in depth in a later chapter.
Use `cargo bless` to automatically generate the `.fixed` file after running Use `cargo bless` to automatically generate the `.fixed` file after running
the tests. the tests.
[rustfix]: https://github.com/rust-lang/rustfix [`rustfix`]: https://github.com/rust-lang/rustfix
[`span_lint_and_sugg`]: https://doc.rust-lang.org/beta/nightly-rustc/clippy_utils/diagnostics/fn.span_lint_and_sugg.html [`span_lint_and_sugg`]: https://doc.rust-lang.org/beta/nightly-rustc/clippy_utils/diagnostics/fn.span_lint_and_sugg.html
## Testing Manually ## Testing Manually