Skip to content

Commit 3affffc

Browse files
committed
Auto merge of #6379 - Suyash458:master, r=flip1995
update readme for specifying msrv add some documentation for the `msrv` feature (#6097) related PR: #6201
2 parents ae57785 + b2eb55b commit 3affffc

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

+26
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,32 @@ cargo clippy -- -A clippy::all -W clippy::useless_format -W clippy::...
194194
```
195195
Note that if you've run clippy before, this may only take effect after you've modified a file or ran `cargo clean`.
196196

197+
### Specifying the minimum supported Rust version
198+
199+
Projects that intend to support old versions of Rust can disable lints pertaining to newer features by
200+
specifying the minimum supported Rust version (MSRV) in the clippy configuration file.
201+
202+
```toml
203+
msrv = "1.30.0"
204+
```
205+
206+
The MSRV can also be specified as an inner attribute, like below.
207+
208+
```rust
209+
#![feature(custom_inner_attributes)]
210+
#![clippy::msrv = "1.30.0"]
211+
212+
fn main() {
213+
...
214+
}
215+
```
216+
217+
Tilde/Caret version requirements (like `^1.0` or `~1.2`) can be specified as well.
218+
219+
Note: `custom_inner_attributes` is an unstable feature so it has to be enabled explicitly.
220+
221+
Lints that recognize this configuration option can be found [here](https://rust-lang.github.io/rust-clippy/master/index.html#msrv)
222+
197223
## Contributing
198224

199225
If you want to contribute to Clippy, you can find more information in [CONTRIBUTING.md](https://github.com/rust-lang/rust-clippy/blob/master/CONTRIBUTING.md).

0 commit comments

Comments
 (0)