Updated some NITs in the documentation from #6630
This commit is contained in:
parent
c56b32899f
commit
69f2b8f0f8
@ -581,15 +581,15 @@ in the following steps:
|
|||||||
3. Passing the configuration value to the lint impl struct:
|
3. Passing the configuration value to the lint impl struct:
|
||||||
|
|
||||||
First find the struct construction in the [clippy_lints lib file](/clippy_lints/src/lib.rs).
|
First find the struct construction in the [clippy_lints lib file](/clippy_lints/src/lib.rs).
|
||||||
Make sure that `clippy dev update_lints` added it beforehand. The configuration value is now
|
The configuration value is now cloned or copied into a local value that is then passed to the
|
||||||
cloned or copied into a local value that is then passed to the impl struct like this:
|
impl struct like this:
|
||||||
```rust
|
```rust
|
||||||
// Default generated registration:
|
// Default generated registration:
|
||||||
store.register_late_pass(|| box module::StructName);
|
store.register_*_pass(|| box module::StructName);
|
||||||
|
|
||||||
// New registration with configuration value
|
// New registration with configuration value
|
||||||
let configuration_ident = conf.configuration_ident.clone();
|
let configuration_ident = conf.configuration_ident.clone();
|
||||||
store.register_late_pass(move || box module::StructName::new(configuration_ident));
|
store.register_*_pass(move || box module::StructName::new(configuration_ident));
|
||||||
```
|
```
|
||||||
|
|
||||||
Congratulations the work is almost done. The configuration value can now be accessed
|
Congratulations the work is almost done. The configuration value can now be accessed
|
||||||
@ -599,7 +599,7 @@ in the following steps:
|
|||||||
1. The default configured value can be tested like any normal lint in [`tests/ui`](/tests/ui).
|
1. The default configured value can be tested like any normal lint in [`tests/ui`](/tests/ui).
|
||||||
2. The configuration itself will be tested separately in [`tests/ui-toml`](/tests/ui-toml).
|
2. The configuration itself will be tested separately in [`tests/ui-toml`](/tests/ui-toml).
|
||||||
Simply add a new subfolder with a fitting name. This folder contains a `clippy.toml` file
|
Simply add a new subfolder with a fitting name. This folder contains a `clippy.toml` file
|
||||||
with the configuration value and a rust file that should be linted by clippy. The test can
|
with the configuration value and a rust file that should be linted by Clippy. The test can
|
||||||
otherwise be written as usual.
|
otherwise be written as usual.
|
||||||
|
|
||||||
## Cheatsheet
|
## Cheatsheet
|
||||||
|
@ -109,7 +109,7 @@ See <https://rustc-dev-guide.rust-lang.org/contributing.html#opening-a-pr>.
|
|||||||
| HIR | High-Level Intermediate Representation |
|
| HIR | High-Level Intermediate Representation |
|
||||||
| TCX | Type context |
|
| TCX | Type context |
|
||||||
|
|
||||||
This is a concise list of abbreviations that can come up during clippy development. An extensive
|
This is a concise list of abbreviations that can come up during Clippy development. An extensive
|
||||||
general list can be found in the [rustc-dev-guide glossary][glossary]. Always feel free to ask if
|
general list can be found in the [rustc-dev-guide glossary][glossary]. Always feel free to ask if
|
||||||
an abbreviation or meaning is unclear to you.
|
an abbreviation or meaning is unclear to you.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user