-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(lint): new implicit_minimum_version_req lint
#16321
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
Conversation
| --> Cargo.toml:7:[..] | ||
| | | ||
| 7 | bar = { git = '[ROOTURL]/bar', version = "0.1" } | ||
| | [..]^^^^^ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the redaction of [ROOTURL], we have no control oveer column number, so redact them.
7fac520 to
fa31eaf
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
implicit_minimum_version_req lint
7ce7163 to
20be772
Compare
20be772 to
62036ab
Compare
| return None; | ||
| } | ||
|
|
||
| // This is a lossy suggestion that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Highlight that the suggestion is lossy
Add a new `cargo::implicit_minimum_version_req` lint: Only check if dependency has a single caret requirement. All other requirements (multiple, tilde, wildcard) are not linted by this rule, as they usually have significance on what version fields get specified. This currently lints only dependencies with no workspace inheritance.
This has a future performance that version requirments in `[workspace.dependencies]` shoud avoid reparse
62036ab to
864bf96
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
`unknown_lints` is special that it analyzes only at package level, and warn if your lint is inherited from workspace. According to the discussion in <rust-lang#16321 (comment)>, we should lint against workspace always plus selected packages. This additionally handles unstable lint gating.
`unknown_lints` is special that it analyzes only at package level, and warn if your lint is inherited from workspace. According to the discussion in <rust-lang#16321 (comment)>, we should lint against workspace always plus selected packages. This additionally handles unstable lint gating.
### What does this PR try to resolve? `unknown_lints` is special that it analyzes only at package level, and warn if your lint is inherited from workspace. According to the discussion in <#16321 (comment)>, we should lint against workspace always plus selected packages. This additionally handles unstable lint gating. ### How to test and review this PR? Two new tests are added to reflect that workspace lints were not analyzed if not inheriting.
What does this PR try to resolve?
Add a new
cargo::implicit_minimum_version_reqlint:Only check if dependency has a single caret requirement.
All other requirements (multiple, tilde, wildcard)
are not linted by this rule, as they usually have significance
on what version fields get specified.
Fixes #15577
How to test and review this PR?
implicit_minimum_version_reqlint #16321 (comment)allowbecause this may get people a lot of warnings)implicit_minimum_version_reqlint #16321 (comment)implicit_minimum_version_reqlint #16321 (comment)implicit_minimum_version_reqlint #16321 (comment) suggesting the lowerest bound (adding missing zeros)