diff options
| author | bors <bors@rust-lang.org> | 2022-10-23 05:05:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-23 05:05:23 +0000 |
| commit | 28cd1ec9b7dc0eef2ecf9f3ee95fd2179802b712 (patch) | |
| tree | ccafaa0ca9e6944c71b03ea9e39ac724f5b86ac6 /book/src/development | |
| parent | b62ef608d751925398ef33d1946acde2eab90d49 (diff) | |
| parent | 815876d93f75c4d20c52cdd32f1a521ce306be63 (diff) | |
| download | rust-28cd1ec9b7dc0eef2ecf9f3ee95fd2179802b712.tar.gz rust-28cd1ec9b7dc0eef2ecf9f3ee95fd2179802b712.zip | |
Auto merge of #9688 - Alexendoo:msrv-tests, r=Manishearth
Move MSRV tests into the lint specific test files There are currently two ways MSRV tests are done in the ui test suite, adding a case to the `#![clippy::msrv = "1.0"]` `tests/ui/min_rust_version_attr.rs` or adding the two `msrv_1_xx` functions to the test file of the lint in question This updates the clippy book to suggest the `msrv_1_xx` style, and replaces the tests in `tests/ui/min_rust_version_attr.rs` with ones of that style Almost the entire diff is just moving stuff around as a result, I made sure to check the line numbers the lints are emitted at correspond with the right `msrv` case, so feel free to only skim that part changelog: none
Diffstat (limited to 'book/src/development')
| -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`: |
