-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(lints): Remove ability to specify -
in lint name
#13837
Conversation
49bf098
to
6c08e58
Compare
@bors r+ |
let dash_feature_name = feature_gate.name().replace("_", "-"); | ||
let title = format!("use of unstable lint `{}`", dash_name); | ||
let title = format!("use of unstable lint `{}`", lint_name); |
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.
nit: implicit arg capture (should we force that in clippy?)
let title = format!("use of unstable lint `{}`", lint_name); | |
let title = format!("use of unstable lint `{lint_name}`"); |
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.
If its something we bring up in code review but could be automated, then yes
with the caveat on how often we don't want it which I believe is pretty rare for this one.
@@ -573,6 +601,120 @@ pub fn check_implicit_features( | |||
Ok(()) | |||
} | |||
|
|||
const UNKNOWN_LINTS: Lint = Lint { |
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.
You know. I'll request for more doc comments like what IMPLICIT_FEATURES
has :)
} else if let Some(group) = LINT_GROUPS.iter().find(|g| g.name == underscore_lint_name) { | ||
Some((group.name, "group")) | ||
} else { | ||
None |
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.
Besides dash-replaced, should we also leverage util::edit_distance::closest
to find one more possible suggestion?
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.
We should. I saw that as a future improvement. The minimum we needed in this case was to help with dropping support for -
.
☀️ Test successful - checks-actions |
Update cargo 18 commits in 6087566b3fa73bfda29702632493e938b12d19e5..05364cb2f61a2c2b091e061c1f42b207dfb5f81f 2024-04-30 20:45:20 +0000 to 2024-05-03 16:48:59 +0000 - chore(deps): update msrv (3 versions) to v1.76 (rust-lang/cargo#13857) - Stabilize `-Zcheck-cfg` as always enabled (rust-lang/cargo#13571) - fix(lints): Prevent inheritance from bring exposed for published packages (rust-lang/cargo#13852) - refactor: remove unnecessary branch for link binary on macOS (rust-lang/cargo#13851) - perf(toml): Avoid inferring when targets are known (rust-lang/cargo#13849) - Update continuous-integration.md: Include CircleCI reference (rust-lang/cargo#13850) - chore(deps): update msrv (1 version) to v1.78 (rust-lang/cargo#13848) - Workaround copying file returning EAGAIN on ZFS on mac OS (rust-lang/cargo#13845) - Clean package perf improvements (rust-lang/cargo#13818) - fix(toml): Validate crates_types/proc-macro for bin like others (rust-lang/cargo#13841) - fix(toml): On 2024 Edition, disallow ignored `default-features` when inheriting (rust-lang/cargo#13839) - chore(ci): Ignore openssl deps (rust-lang/cargo#13840) - fix(lints): Remove ability to specify `-` in lint name (rust-lang/cargo#13837) - fix(resolver): Treat unset MSRV as compatible (rust-lang/cargo#13791) - fix(toml): Don't lose 'public' when inheriting a dep (rust-lang/cargo#13836) - chore(deps): update compatible (rust-lang/cargo#13834) - Error when unstable lints are specified but not enabled (rust-lang/cargo#13805) - fix(lint): Warn not Error on unsupported lint tool (rust-lang/cargo#13833) r? ghost Note: this includes the fix that was beta backported in rust-lang#124647
Update cargo 18 commits in 6087566b3fa73bfda29702632493e938b12d19e5..05364cb2f61a2c2b091e061c1f42b207dfb5f81f 2024-04-30 20:45:20 +0000 to 2024-05-03 16:48:59 +0000 - chore(deps): update msrv (3 versions) to v1.76 (rust-lang/cargo#13857) - Stabilize `-Zcheck-cfg` as always enabled (rust-lang/cargo#13571) - fix(lints): Prevent inheritance from bring exposed for published packages (rust-lang/cargo#13852) - refactor: remove unnecessary branch for link binary on macOS (rust-lang/cargo#13851) - perf(toml): Avoid inferring when targets are known (rust-lang/cargo#13849) - Update continuous-integration.md: Include CircleCI reference (rust-lang/cargo#13850) - chore(deps): update msrv (1 version) to v1.78 (rust-lang/cargo#13848) - Workaround copying file returning EAGAIN on ZFS on mac OS (rust-lang/cargo#13845) - Clean package perf improvements (rust-lang/cargo#13818) - fix(toml): Validate crates_types/proc-macro for bin like others (rust-lang/cargo#13841) - fix(toml): On 2024 Edition, disallow ignored `default-features` when inheriting (rust-lang/cargo#13839) - chore(ci): Ignore openssl deps (rust-lang/cargo#13840) - fix(lints): Remove ability to specify `-` in lint name (rust-lang/cargo#13837) - fix(resolver): Treat unset MSRV as compatible (rust-lang/cargo#13791) - fix(toml): Don't lose 'public' when inheriting a dep (rust-lang/cargo#13836) - chore(deps): update compatible (rust-lang/cargo#13834) - Error when unstable lints are specified but not enabled (rust-lang/cargo#13805) - fix(lint): Warn not Error on unsupported lint tool (rust-lang/cargo#13833) r? ghost Note: this includes the fix that was beta backported in rust-lang#124647
Update cargo 18 commits in 6087566b3fa73bfda29702632493e938b12d19e5..05364cb2f61a2c2b091e061c1f42b207dfb5f81f 2024-04-30 20:45:20 +0000 to 2024-05-03 16:48:59 +0000 - chore(deps): update msrv (3 versions) to v1.76 (rust-lang/cargo#13857) - Stabilize `-Zcheck-cfg` as always enabled (rust-lang/cargo#13571) - fix(lints): Prevent inheritance from bring exposed for published packages (rust-lang/cargo#13852) - refactor: remove unnecessary branch for link binary on macOS (rust-lang/cargo#13851) - perf(toml): Avoid inferring when targets are known (rust-lang/cargo#13849) - Update continuous-integration.md: Include CircleCI reference (rust-lang/cargo#13850) - chore(deps): update msrv (1 version) to v1.78 (rust-lang/cargo#13848) - Workaround copying file returning EAGAIN on ZFS on mac OS (rust-lang/cargo#13845) - Clean package perf improvements (rust-lang/cargo#13818) - fix(toml): Validate crates_types/proc-macro for bin like others (rust-lang/cargo#13841) - fix(toml): On 2024 Edition, disallow ignored `default-features` when inheriting (rust-lang/cargo#13839) - chore(ci): Ignore openssl deps (rust-lang/cargo#13840) - fix(lints): Remove ability to specify `-` in lint name (rust-lang/cargo#13837) - fix(resolver): Treat unset MSRV as compatible (rust-lang/cargo#13791) - fix(toml): Don't lose 'public' when inheriting a dep (rust-lang/cargo#13836) - chore(deps): update compatible (rust-lang/cargo#13834) - Error when unstable lints are specified but not enabled (rust-lang/cargo#13805) - fix(lint): Warn not Error on unsupported lint tool (rust-lang/cargo#13833) r? ghost Note: this includes the fix that was beta backported in #124647
In a recent Cargo Team meeting, it was discussed whether our lint should use
-
or_
and if we should rewrite the wrong form to the correct one. It was decided that Cargo would use_
for lint names and would not convert-
to_
automatically; instead, we would warn about an "unknown lint" and mention the similarly named lint with_
, if found.The decision to ise
_
was made because it is the canonical representation, as well as RFC #344 specifies:This PR implements these changes.
Note: This adds an
unknown_lints
lint, that tries to mirror the lintrustc
has with the same name.