diff options
| author | Philipp Krones <hello@philkrones.com> | 2023-08-18 19:29:00 +0200 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2023-08-18 20:16:26 +0200 |
| commit | 8ee6ca0981e2087c24ecd8018bbb20437e8ce777 (patch) | |
| tree | d986e3b90feb6dc7cd8ffb87dc09b0bfaa3c5f74 | |
| parent | 32dc7c592d7911ad8d80ec3cc28dfd39c9c04f06 (diff) | |
| download | rust-8ee6ca0981e2087c24ecd8018bbb20437e8ce777.tar.gz rust-8ee6ca0981e2087c24ecd8018bbb20437e8ce777.zip | |
Update rustfix section to new ui-test crate
| -rw-r--r-- | book/src/development/writing_tests.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/book/src/development/writing_tests.md b/book/src/development/writing_tests.md index c7f67dcae9f..7cb530a3bb9 100644 --- a/book/src/development/writing_tests.md +++ b/book/src/development/writing_tests.md @@ -191,15 +191,16 @@ and prepending the `TESTNAME` variable to `cargo uitest` works for Cargo lints t ## Rustfix Tests -If the lint you are working on is making use of structured suggestions, the test -file should include a `// run-rustfix` comment at the top. +If the lint you are working on is making use of structured suggestions, +[`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 been linted with [`span_lint_and_sugg`]. -The `// run-rustfix` comment will additionally run [rustfix] for our test. -Rustfix will apply the suggestions from the lint to the test file code and -compare that to the contents of a `.fixed` file. +Should `span_lint_and_sugg` be used to generate a suggestion, but not all +suggestions lead to valid code, you can use the `//@no-rustfix` comment on top +of the test file, to not run `rustfix` on that file. We'll talk about suggestions more in depth in a later chapter. <!-- 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 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 ## Testing Manually |
