-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimum supported version of Rust (MSVR) config and support #6097
Comments
I think this makes sense. This should be possible by just adding a "lint configuration" and passing that to the relevant lint passes. |
@flip1995 I'd like to pick this up! |
This would be awesome to have. I know we have a bunch of these allows in the url crate already at least. |
@djc Can you post a list of them here, so we can apply this configuration option to those lints? That would be really helpful! |
In url we have these:
The |
|
@flip1995 do we need to add an |
No, just the lints mentioned here. And then, we can iteratively add it to lints in the future, if a issue for them comes up. |
Just a heads up: |
THIS! Just got bitten by Can we perhaps also add a lint that will suggest setting the Also, oddly enough, Debian stable contains rustc 1.41.1, but oddly enough cargo 1.42.1, so please make sure the version is compared against rustc not against cargo. |
Besides making this lint only configurable in the config file, we may want to also make it configurable with an attribute, like
This could be implemented once cargo supports setting it, aka once the bikeshedding in rust-lang/rust#65262 is over and someone implements it ;) Otherwise I don't think a lint that always triggers on every crate to mention the |
add msrv attribute to lints listed in rust-lang#6097
…#6097 add configuration option for minimum supported rust version add msrv attribute to lints listed in rust-lang#6097 generify `LimitStack` for use in other lints update the `cognitive_complexity` lint to use a `LimitStack<u64>` update existing tests with the msrv attribute
…#6097 add configuration option for minimum supported rust version add msrv attribute to lints listed in rust-lang#6097 generify `LimitStack` for use in other lints update the `cognitive_complexity` lint to use a `LimitStack<u64>` update existing tests with the msrv attribute
|
Some have already been mentioned, but I have a list of (13) lints that requires newer compilers:
(I have not checked the versions older than 1.31. I knew about |
cc @suyash458 ^ I would not add them in #6201. This PR is already big enough as it is. Let's add the remaining ones in a separate PR after #6201 is merged. |
…#6097 add configuration option for minimum supported rust version add msrv attribute to some lints listed in rust-lang#6097 add tests
…#6097 add configuration option for minimum supported rust version add msrv attribute to some lints listed in rust-lang#6097 add tests
add configuration option for minimum supported rust version add msrv attribute to some lints listed in rust-lang#6097 add tests
update tests
update tests
update tests
update tests
Add MSRV to more lints specified in #6097 add MSRV to more lints specified in #6097 add instructions for adding msrv in other lints update tests - [x] `redundant_field_names` requires Rust 1.17 due to suggest feature stablized in that version. - [x] `redundant_static_lifetimes` requires Rust 1.17 due to suggest feature stablized in that version. - [x] `filter_map_next` requires Rust 1.30 due to suggest `Iterator::find_map`. - [x] `checked_conversions` requires Rust 1.34 due to suggest `TryFrom`. - [x] `match_like_matches_macro` requires Rust 1.42 due to suggest `matches!`. Addressed in #6201 - [x] `manual_strip` requires Rust 1.45 due to suggest `str::{strip_prefix, strip_suffix}`. Addressed in #6201 - [x] `option_as_ref_deref` requires Rust 1.40 due to suggest `Option::{as_deref, as_deref_mut}`. Addressed in #6201 - [x] `manual_non_exhaustive` requires Rust 1.40 due to suggest `#[non_exhaustive]`. Addressed in #6201 - [x] `manual_range_contains` requires Rust 1.35 due to suggest `Range*::contains`. - [x] `use_self` requires Rust 1.37 due to suggest `Self::Variant on enum`. - [x] `mem_replace_with_default` requires Rust 1.40 due to suggest `mem::take`. - [x] `map_unwrap_or` requires Rust 1.41 due to suggest `Result::{map_or, map_or_else}`. - [x] `missing_const_for_fn` requires Rust 1.46 due to `match/if/loop in const fn` needs that version. changelog: Add MSRV config to more lints. ^This is now the complete list, AFAWK
@flip1995 is this good to be closed now? |
Hmm, the msrv list in docs mentions only four lints, but there are more in #6097 (comment) |
@suyash458 The lints also have to be added here: rust-clippy/clippy_lints/src/utils/conf.rs Line 109 in 5c00931
|
Many lints suggest using new features in the std lib like
clippy::manual_strip
. I think these are great because they help people upgrade their code to take advantage of these features. However, there are many projects that support old versions of Rust that can't use these. These lints only make more work for those projects because they have to allows to fix their CI. See this recent commit in serde-yaml for example.I'd like to add a key to
clippy.toml
to specify the minimum version of rust (and the stdlib) that a project supports. We can conditionally register these lints that target features not supported on that version.I understand that eventually proper support for this will be added to Cargo and rustc to support this but at that stage we can just deprecate the setting and use the new stuff.
The text was updated successfully, but these errors were encountered: