Skip to content
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

chore: Clippy fixes for 1.80 #13987

Merged
merged 1 commit into from
Jul 10, 2024
Merged

chore: Clippy fixes for 1.80 #13987

merged 1 commit into from
Jul 10, 2024

Conversation

osiewicz
Copy link
Contributor

@osiewicz osiewicz commented Jul 9, 2024

The biggest hurdle turned out to be use of Arc<Language> in maps, as clippy::mutable_key_type started triggering on it (due to - I suppose - internal mutability on HighlightMap?). I switched over to using LanguageId as the key type in some of the callsites, as that's what Language uses anyways for it's hash/eq, though I've still had to suppress the lint outside of language crate.

/cc @maxdeviant , le clippy guru.

Release Notes:

  • N/A

The biggest hurdle turned out to be use of Arc<Language> in maps, as clippy::mutable_key_type started triggering on it (due to - I suppose - internal mutability on HighlightMap?).
I switched over to using LanguageId as the key type, as that's what Language uses anyways for it's hash/eq, though I've still had to suppress the lint outside of language crate.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Jul 9, 2024
@@ -518,7 518,7 @@ single_range_in_vec_init = "allow"

# There are a bunch of rules currently failing in the `style` group, so
# allow all of those, for now.
style = "allow"
style = { level = "allow", priority = -1 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my understanding, what does priority = -1 do here?

Copy link
Contributor Author

@osiewicz osiewicz Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR:

error: lint group `style` has the same priority (0) as a lint
   --> Cargo.toml:521:1
    |
521 | style = { level = "allow"}
    | ^^^^^   ------------------ has an implicit priority of 0
...
524 | almost_complete_range = "allow"
    | --------------------- has the same priority as this lint
    |
    = note: the order of the lints in the table is ignored by Cargo
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#lint_groups_priority
    = note: `#[deny(clippy::lint_groups_priority)]` on by default
help: to have lints override the group set `style` to a lower priority
    |
521 | style = { level = "allow", priority = -1 }

So in short, it seems that it explicitly gives style group lower priority, in case other items in the lints table wanted to override a single/several item from it. It's a bit silly, because we do not opt into style lints, but that's probably on the lint implementation and not on us.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like in the lint implementation, they simply look for a group specifier (style) and any other specifier (almost_complete_range) that has the same priority.
https://github.com/rust-lang/rust-clippy/blob/master/clippy_lints/src/cargo/lint_groups_priority.rs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation! That's good to know.

@osiewicz osiewicz merged commit 33a67ad into main Jul 10, 2024
10 checks passed
@osiewicz osiewicz deleted the clippy-fixes-for-1.80 branch July 10, 2024 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed The user has signed the Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants