File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -191,23 +191,24 @@ and prepending the `TESTNAME` variable to `cargo uitest` works for Cargo lints t
191
191
192
192
## Rustfix Tests
193
193
194
- If the lint you are working on is making use of structured suggestions, the test
195
- file should include a ` // run-rustfix ` comment at the top.
194
+ If the lint you are working on is making use of structured suggestions,
195
+ [ ` rustfix ` ] will apply the suggestions from the lint to the test file code and
196
+ compare that to the contents of a ` .fixed ` file.
196
197
197
198
Structured suggestions tell a user how to fix or re-write certain code that has
198
199
been linted with [ ` span_lint_and_sugg ` ] .
199
200
200
- The ` // run-rustfix ` comment will additionally run [ rustfix ] for our test.
201
- Rustfix will apply the suggestions from the lint to the test file code and
202
- compare that to the contents of a ` .fixed ` file.
201
+ Should ` span_lint_and_sugg ` be used to generate a suggestion, but not all
202
+ suggestions lead to valid code, you can use the ` //@no-rustfix ` comment on top
203
+ of the test file, to not run ` rustfix ` on that file.
203
204
204
205
We'll talk about suggestions more in depth in a later chapter.
205
206
<!-- FIXME: (blyxyas) Link to "Emitting lints" when that gets merged -->
206
207
207
208
Use ` cargo bless ` to automatically generate the ` .fixed ` file after running
208
209
the tests.
209
210
210
- [ rustfix ] : https://github.com/rust-lang/rustfix
211
+ [ ` rustfix` ] : https://github.com/rust-lang/rustfix
211
212
[ `span_lint_and_sugg` ] : https://doc.rust-lang.org/beta/nightly-rustc/clippy_utils/diagnostics/fn.span_lint_and_sugg.html
212
213
213
214
## Testing Manually
You can’t perform that action at this time.
0 commit comments