summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/book/src/development/adding_lints.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/clippy/book/src/development/adding_lints.md')
-rw-r--r--src/tools/clippy/book/src/development/adding_lints.md18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/tools/clippy/book/src/development/adding_lints.md b/src/tools/clippy/book/src/development/adding_lints.md
index 3c3f368a5..8b4eee8c9 100644
--- a/src/tools/clippy/book/src/development/adding_lints.md
+++ b/src/tools/clippy/book/src/development/adding_lints.md
@@ -443,27 +443,27 @@ value is passed to the constructor in `clippy_lints/lib.rs`.
```rust
pub struct ManualStrip {
- msrv: Option<RustcVersion>,
+ msrv: Msrv,
}
impl ManualStrip {
#[must_use]
- pub fn new(msrv: Option<RustcVersion>) -> Self {
+ pub fn new(msrv: Msrv) -> Self {
Self { msrv }
}
}
```
The project's MSRV can then be matched against the feature MSRV in the LintPass
-using the `meets_msrv` utility function.
+using the `Msrv::meets` method.
``` rust
-if !meets_msrv(self.msrv, msrvs::STR_STRIP_PREFIX) {
+if !self.msrv.meets(msrvs::STR_STRIP_PREFIX) {
return;
}
```
-The project's MSRV can also be specified as an inner attribute, which overrides
+The project's MSRV can also be specified as an attribute, which overrides
the value from `clippy.toml`. This can be accounted for using the
`extract_msrv_attr!(LintContext)` macro and passing
`LateContext`/`EarlyContext`.
@@ -483,19 +483,15 @@ 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)]
-
...
+#[clippy::msrv = "1.44"]
fn msrv_1_44() {
- #![clippy::msrv = "1.44"]
-
/* something that would trigger the lint */
}
+#[clippy::msrv = "1.45"]
fn msrv_1_45() {
- #![clippy::msrv = "1.45"]
-
/* something that would trigger the lint */
}
```