-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Allow clippy::type_complexity
in more places.
#9796
Allow clippy::type_complexity
in more places.
#9796
Conversation
When running clippy in CI we use pre configured lints because we don't want to pollute the repo with a bunch of annotations like that. Personally, I added this config to my rust analyzer to use the same lints as bevy "rust-analyzer.check.command": "clippy",
"rust-analyzer.check.extraArgs": [
"--all-features",
"--",
"-Aclippy::type_complexity",
"-Wclippy::doc_markdown",
"-Wclippy::redundant_else",
"-Wclippy::match_same_arms",
"-Wclippy::semicolon_if_nothing_returned",
"-Wclippy::explicit_iter_loop",
"-Wclippy::map_flatten",
"-Dwarnings"
], |
I thought about that, but there were already about 37 of these in the code (every crate basically except the new asset crate). |
We should do this -- see #8313 which did this for everything except for our examples. Initially I didn't do this for the examples because it just seemed like a lot, but given that disabling this lint is considered best practice, it's a good idea to teach users via our examples. We should add a comment to each one, something like // This lint usually gives bad advice in the context of Bevy -- hiding complex queries behind
// type alias tends to obfuscate code while offering no improvement in code cleanliness. I'd go a step further and remove the lint suppression from CI, so we have only one source of truth for this lint (which was the opinion cart originally expressed in the aforementioned PR). |
I'll update this. To avoid a conflict, we'll need #9794 to land before this. |
807faf7
to
2cf0100
Compare
I removed |
2cf0100
to
48cd4e5
Compare
48cd4e5
to
36718ea
Compare
@waywardmonkeys can you fix merge conflicts and then I'll merge? |
Sure thing. I am almost done with dinner and then will do it |
36718ea
to
fb093ba
Compare
fb093ba
to
3847fc3
Compare
@alice-i-cecile Done! Hopefully everything is correct with the latest push. |
# Objective - See fewer warnings when running `cargo clippy` locally. ## Solution - allow `clippy::type_complexity` in more places, which also signals to users they should do the same.
# Objective - See fewer warnings when running `cargo clippy` locally. ## Solution - allow `clippy::type_complexity` in more places, which also signals to users they should do the same.
…erywhere (#10011) # Objective - Fix adding `#![allow(clippy::type_complexity)]` everywhere. like #9796 ## Solution - Use the new [lints] table that will land in 1.74 (https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#lints) - inherit lint to the workspace, crates and examples. ``` [lints] workspace = true ``` ## Changelog - Bump rust version to 1.74 - Enable lints table for the workspace ```toml [workspace.lints.clippy] type_complexity = "allow" ``` - Allow type complexity for all crates and examples ```toml [lints] workspace = true ``` --------- Co-authored-by: Martín Maita <47983254+mnmaita@users.noreply.github.com>
# Objective - See fewer warnings when running `cargo clippy` locally. ## Solution - allow `clippy::type_complexity` in more places, which also signals to users they should do the same.
…erywhere (bevyengine#10011) # Objective - Fix adding `#![allow(clippy::type_complexity)]` everywhere. like bevyengine#9796 ## Solution - Use the new [lints] table that will land in 1.74 (https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#lints) - inherit lint to the workspace, crates and examples. ``` [lints] workspace = true ``` ## Changelog - Bump rust version to 1.74 - Enable lints table for the workspace ```toml [workspace.lints.clippy] type_complexity = "allow" ``` - Allow type complexity for all crates and examples ```toml [lints] workspace = true ``` --------- Co-authored-by: Martín Maita <47983254+mnmaita@users.noreply.github.com>
Objective
cargo clippy
locally.Solution
clippy::type_complexity
in more places, which also signals to users they should do the same.