@@ -547,9 +547,9 @@ Before submitting your PR make sure you followed all of the basic requirements:
547
547
548
548
## Adding configuration to a lint
549
549
550
- Clippy supports the configuration of lints values using a ` clippy.toml ` file in the workspace
550
+ Clippy supports the configuration of lints values using a ` clippy.toml ` file in the workspace
551
551
directory. Adding a configuration to a lint can be useful for thresholds or to constrain some
552
- behavior that can be seen as a false positive for some users. Adding a configuration is done
552
+ behavior that can be seen as a false positive for some users. Adding a configuration is done
553
553
in the following steps:
554
554
555
555
1 . Adding a new configuration entry to [ clippy_utils::conf] ( /clippy_utils/src/conf.rs )
@@ -558,10 +558,10 @@ in the following steps:
558
558
/// Lint: LINT_NAME. <The configuration field doc comment>
559
559
(configuration_ident , " configuration_value" : Type , DefaultValue ),
560
560
```
561
- The configuration value and identifier should usually be the same . The doc comment will be
561
+ The configuration value and identifier should usually be the same . The doc comment will be
562
562
automatically added to the lint documentation .
563
563
2 . Adding the configuration value to the lint impl struct :
564
- 1 . This first requires the definition of a lint impl struct . Lint impl structs are usually
564
+ 1 . This first requires the definition of a lint impl struct . Lint impl structs are usually
565
565
generated with the `declare_lint_pass! ` macro . This struct needs to be defined manually
566
566
to add some kind of metadata to it :
567
567
```rust
@@ -578,7 +578,7 @@ in the following steps:
578
578
LINT_NAME
579
579
]);
580
580
```
581
-
581
+
582
582
2 . Next add the configuration value and a corresponding creation method like this :
583
583
```rust
584
584
#[derive(Copy , Clone )]
@@ -598,7 +598,7 @@ in the following steps:
598
598
```
599
599
3 . Passing the configuration value to the lint impl struct :
600
600
601
- First find the struct construction in the [clippy_lints lib file ](/ clippy_lints / src / lib . rs).
601
+ First find the struct construction in the [clippy_lints lib file ](/ clippy_lints / src / lib . rs).
602
602
The configuration value is now cloned or copied into a local value that is then passed to the
603
603
impl struct like this :
604
604
```rust
@@ -615,9 +615,9 @@ in the following steps:
615
615
616
616
4 . Adding tests :
617
617
1 . The default configured value can be tested like any normal lint in [`tests / ui `](/ tests / ui ).
618
- 2 . The configuration itself will be tested separately in [`tests / ui - toml `](/ tests / ui - toml ).
619
- Simply add a new subfolder with a fitting name . This folder contains a `clippy . toml` file
620
- with the configuration value and a rust file that should be linted by Clippy . The test can
618
+ 2 . The configuration itself will be tested separately in [`tests / ui - toml `](/ tests / ui - toml ).
619
+ Simply add a new subfolder with a fitting name . This folder contains a `clippy . toml` file
620
+ with the configuration value and a rust file that should be linted by Clippy . The test can
621
621
otherwise be written as usual .
622
622
623
623
## Cheatsheet
0 commit comments