Skip to content

Commit

Permalink
Avoid unnecessary warnings with older Clippy versions
Browse files Browse the repository at this point in the history
In 80e0101, I first added a rule for a new Clippy lint (introduced in
1.73.0) to fix our optional CI check that lints with the beta toolchain.
This would break the required CI check against the MSRV so I decided to
allow unknown lints for that check in ef29d94. However, this isn't ideal
as it only applies to the CI checks and still shows the warnings when
developing or rather linting locally.
Luckily we can use the rustversion crate to make the Clippy lint
overrides via macros also depend on the Rust/toolchain version (this
especially helps with cases like in 0556536 where the override is only
required for a single toolchain version).

Signed-off-by: Michael Weiss <michael.weiss@eviden.com>
  • Loading branch information
primeos-work committed Mar 6, 2024
1 parent 3b46e29 commit 85e3a39
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ jobs:
include:
- rust: 1.74.0 # MSRV
optional: false
extra_opts: "-A unknown-lints"
- rust: beta
optional: true
steps:
Expand All @@ -114,7 +113,7 @@ jobs:
with:
shared-key: "ci"
- name: cargo clippy
run: cargo clippy --all-targets -- -D warnings ${{ matrix.extra_opts }}
run: cargo clippy --all-targets -- -D warnings

# This "accumulation" job is used as the required CI check for PRs.
# We could require multiple jobs but the MSRV is subject to change and makes
Expand Down
2 changes: 1 addition & 1 deletion src/package/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl<'a> std::fmt::Debug for DebugPackage<'a> {
impl PartialEq for Package {
// Ignore the following lint as it results in a false positive with clippy 0.1.77
// (TODO: drop this once we bump the MSRV to 1.78):
#[allow(clippy::unconditional_recursion)]
#[rustversion::attr(stable(1.77), allow(clippy::unconditional_recursion))]
fn eq(&self, other: &Package) -> bool {
(self.name(), self.version()).eq(&(other.name(), other.version()))
}
Expand Down

0 comments on commit 85e3a39

Please sign in to comment.