diff options
| author | Alex Macleod <alex@macleod.io> | 2022-10-21 21:35:39 +0000 |
|---|---|---|
| committer | Alex Macleod <alex@macleod.io> | 2022-10-21 21:35:39 +0000 |
| commit | 815876d93f75c4d20c52cdd32f1a521ce306be63 (patch) | |
| tree | 58ddf1d8cebdf0129a76002fa072b662c18d512c /book/src/development/adding_lints.md | |
| parent | b72e451310d65ddf69441a641e2ebd6886c813b8 (diff) | |
| download | rust-815876d93f75c4d20c52cdd32f1a521ce306be63.tar.gz rust-815876d93f75c4d20c52cdd32f1a521ce306be63.zip | |
Move MSRV tests into the lint specific test files
Diffstat (limited to 'book/src/development/adding_lints.md')
| -rw-r--r-- | book/src/development/adding_lints.md | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/book/src/development/adding_lints.md b/book/src/development/adding_lints.md index b1e843bc7f4..3c3f368a529 100644 --- a/book/src/development/adding_lints.md +++ b/book/src/development/adding_lints.md @@ -478,8 +478,27 @@ impl<'tcx> LateLintPass<'tcx> for ManualStrip { ``` Once the `msrv` is added to the lint, a relevant test case should be added to -`tests/ui/min_rust_version_attr.rs` which verifies that the lint isn't emitted -if the project's MSRV is lower. +the lint's test file, `tests/ui/manual_strip.rs` in this example. It should +have a case for the version below the MSRV and one with the same contents but +for the MSRV version itself. + +```rust +#![feature(custom_inner_attributes)] + +... + +fn msrv_1_44() { + #![clippy::msrv = "1.44"] + + /* something that would trigger the lint */ +} + +fn msrv_1_45() { + #![clippy::msrv = "1.45"] + + /* something that would trigger the lint */ +} +``` As a last step, the lint should be added to the lint documentation. This is done in `clippy_lints/src/utils/conf.rs`: |
