@@ -88,13 +88,13 @@ As we gradually implement our lint logic, we will keep running this UI test comm
8888Clippy will begin outputting information that allows us to check if the output is
8989turning into what we want it to be.
9090
91+ blyxyas marked this conversation as resolved.
9192### Example output
9293
9394As our ` foo_functions ` lint is tested, the output would look something like this:
9495
9596```
9697failures:
97-
9898---- compile_test stdout ----
9999normalized stderr:
100100error: function called "foo"
@@ -104,19 +104,16 @@ LL | pub fn foo(&self) {}
104104 | ^^^
105105 |
106106 = note: `-D clippy::foo-functions` implied by `-D warnings`
107-
108107error: function called "foo"
109108 --> $DIR/foo_functions.rs:13:8
110109 |
111110LL | fn foo(&self) {}
112111 | ^^^
113-
114112error: function called "foo"
115113 --> $DIR/foo_functions.rs:19:4
116114 |
117115LL | fn foo() {}
118116 | ^^^
119-
120117error: aborting due to 3 previous errors
121118```
122119
@@ -191,23 +188,23 @@ and prepending the `TESTNAME` variable to `cargo uitest` works for Cargo lints t
191188
192189## Rustfix Tests
193190
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.
191+ If the lint you are working on is making use of structured suggestions,
192+ ` rustfix ` will apply the suggestions from the lint to the test file code and
193+ compare that to the contents of a ` .fixed ` file.
196194
197195Structured suggestions tell a user how to fix or re-write certain code that has
198196been linted with [ ` span_lint_and_sugg ` ] .
199197
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.
198+ Should ` span_lint_and_sugg ` be used to generate a suggestion, but not all
199+ suggestions lead to valid code, you can use the ` //@no-rustfix ` comment on top
200+ of the test file, to not run ` rustfix ` on that file.
203201
204202We'll talk about suggestions more in depth in a later chapter.
205203<!-- FIXME: (blyxyas) Link to "Emitting lints" when that gets merged -->
206204
207205Use ` cargo bless ` to automatically generate the ` .fixed ` file after running
208206the tests.
209207
210- [ rustfix ] : https://github.com/rust-lang/rustfix
211208[ `span_lint_and_sugg` ] : https://doc.rust-lang.org/beta/nightly-rustc/clippy_utils/diagnostics/fn.span_lint_and_sugg.html
212209
213210## Testing Manually
0 commit comments