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

clippy: disable bogus lints for nightly clippy #3452

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

thoughtpolice
Copy link
Contributor

@thoughtpolice thoughtpolice commented Apr 4, 2024

I'm experimenting with using nightly inside the Nix build, in order to use the parallel rustc frontend and cranelift, and this really helps avoid bogus/spurious clippy warnings.

I suspect @ilyagr might have opinions on this, since he's tracked a bunch of these regressions along with me.

As an alternative to #[allow(unknown_lints)] — which I am not a huge fan of — I think we could also wire up a build.rs that detects the rustc version and emits cargo:rustc-cfg=nightly which would allow us to conditionalize the macro on #[cfg(nightly)]. But maybe this is good enough.

@thoughtpolice thoughtpolice requested a review from ilyagr April 4, 2024 16:21
@thoughtpolice thoughtpolice self-assigned this Apr 4, 2024
The nightly compiler has several clippy fix-its that, if applied, break the
build. There are various bugs about this, but there isn't enough space in the
margins to detail it all.

Just ignore these on a per-function basis; about 70% of them are just multiple
instances happening inside a single function.

This makes `cargo clippy --workspace --all-targets` run clean, even with the
nightly compiler.

Signed-off-by: Austin Seipp <[email protected]>
Change-Id: Ic26a025d3c62b12fbf096171308b56e38f7d1bb9
@thoughtpolice thoughtpolice force-pushed the aseipp/push-xqrwmzyqwtnx branch from 6782544 to 1105366 Compare April 4, 2024 16:30
@ilyagr
Copy link
Contributor

ilyagr commented Apr 5, 2024

I'm not sure what's best to do here in general, but now that you wrote this, let's use it!

I think the manual_unwrap_or_default ones will be fixed soonish, but not yet.

My current solution is to use https://github.com/ericseppanen/cargo-cranky and put Cranky.toml into the global (per-user) gitignore.

# Cranky.toml
allow = [
  # "unknown_lints", # Needed on beta channell
  "clippy::assigning_clones",
  "clippy::manual_unwrap_or_default",
]

Another option for rust-analyzer is a setting VS Code has to disable lints.

Here are some related bugs and a PR.

rust-lang/rust-clippy#12610
rust-lang/rust-clippy#12553
rust-lang/rust-clippy#12444
rust-lang/rust-clippy#12564
rust-lang/rust-clippy#12460
rust-lang/rust-clippy#12467

@thoughtpolice thoughtpolice merged commit 4b45dde into main Apr 5, 2024
16 checks passed
@thoughtpolice thoughtpolice deleted the aseipp/push-xqrwmzyqwtnx branch April 5, 2024 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants