@@ -38,11 +38,11 @@ we want to check. The output of Clippy is compared against a `.stderr` file.
38
38
Note that you don't have to create this file yourself, we'll get to
39
39
generating the ` .stderr ` files further down.
40
40
41
- Let's create the test file at ` tests/ui/foo_functions.rs ` . It doesn't really
42
- matter what the file is called, but it's a good convention to name it after the
43
- lint it is testing, so ` foo_functions.rs ` it is.
41
+ We start by creating the test file at ` tests/ui/foo_functions.rs ` . It doesn't
42
+ really matter what the file is called, but it's a good convention to name it
43
+ after the lint it is testing, so ` foo_functions.rs ` it is.
44
44
45
- Inside we put some examples to get started:
45
+ Inside the file we put some examples to get started:
46
46
47
47
``` rust
48
48
#![warn(clippy:: foo_functions)]
@@ -80,13 +80,13 @@ Now we can run the test with `TESTNAME=ui/foo_functions cargo uitest`.
80
80
Currently this test will fail. If you go through the output you will see that we
81
81
are told that ` clippy::foo_functions ` is an unknown lint, which is expected.
82
82
83
- While you are working on implementing your lint, you can keep running the UI
84
- test. That allows you to check if the output is turning into what you want.
83
+ While we are working on implementing our lint, we can keep running the UI
84
+ test. That allows us to check if the output is turning into what we want.
85
85
86
- Once you are satisfied with the output, you need to run
87
- ` tests/ui/update-all-references.sh ` to update the ` .stderr ` file for your lint.
88
- Running ` TESTNAME=ui/foo_functions cargo uitest ` should pass then. When you
89
- commit your lint, be sure to commit the ` .stderr ` files, too.
86
+ Once we are satisfied with the output, we need to run
87
+ ` tests/ui/update-all-references.sh ` to update the ` .stderr ` file for our lint.
88
+ Running ` TESTNAME=ui/foo_functions cargo uitest ` should pass then. When we
89
+ commit our lint, we need to commit the generated ` .stderr ` files, too.
90
90
91
91
### Rustfix tests
92
92
@@ -139,8 +139,8 @@ state the thing that is being checked for and read well when used with
139
139
* The last part should be a text that explains what exactly is wrong with the
140
140
code
141
141
142
- With our lint declaration done, we will now make sure that our lint declaration
143
- is assigned to a lint pass:
142
+ With our lint declaration done, we will now make sure that it is assigned to a
143
+ lint pass:
144
144
145
145
``` rust
146
146
// clippy_lints/src/foo_functions.rs
@@ -166,10 +166,10 @@ impl LintPass for FooFunctionsPass {
166
166
Don't worry about the ` name ` method here. As long as it includes the name of the
167
167
lint pass it should be fine.
168
168
169
- Next you should run ` util/dev update_lints ` to register the lint in various
169
+ Next we need to run ` util/dev update_lints ` to register the lint in various
170
170
places, mainly in ` clippy_lints/src/lib.rs ` .
171
171
172
- While ` update_lints ` automates some things, it doesn't automate everything. You
172
+ While ` update_lints ` automates some things, it doesn't automate everything. We
173
173
will have to register our lint pass manually in the ` register_plugins ` function
174
174
in ` clippy_lints/src/lib.rs ` :
175
175
@@ -251,7 +251,7 @@ Running our UI test should now produce output that contains the lint message.
251
251
252
252
### Adding the lint logic
253
253
254
- Writing the logic for our lint will most likely be different from this example,
254
+ Writing the logic for your lint will most likely be different from our example,
255
255
so this section is kept rather short.
256
256
257
257
Using the [ ` check_fn ` ] [ check_fn ] method gives us access to [ ` FnKind ` ] [ fn_kind ]
@@ -295,7 +295,7 @@ fn is_foo_fn(fn_kind: FnKind<'_>) -> bool {
295
295
}
296
296
```
297
297
298
- Now you'll want to also run the full test suite with ` cargo test ` . At this point
298
+ Now we should also run the full test suite with ` cargo test ` . At this point
299
299
running ` cargo test ` should produce the expected output. Remember to run
300
300
` tests/ui/update-all-references.sh ` to update the ` .stderr ` file.
301
301
@@ -386,6 +386,7 @@ Before submitting your PR make sure you followed all of the basic requirements:
386
386
- [ ] Followed [ lint naming conventions] [ lint_naming ]
387
387
- [ ] Added passing UI tests (including committed ` .stderr ` file)
388
388
- [ ] ` cargo test ` passes locally
389
+ - [ ] Executed ` util/dev update_lints `
389
390
- [ ] Added lint documentation
390
391
391
392
### Cheatsheet
0 commit comments