chore: Move lint configuration from `.cargo/config.toml` to `Cargo.toml`

This got stabilized in Rust 1.74.
This commit is contained in:
TÖRÖK Attila 2024-01-04 21:40:04 +01:00
parent 89b7f7a6b8
commit 60f01fd517
2 changed files with 11 additions and 16 deletions

View File

@ -4,20 +4,4 @@ rustflags = [
# We need to specify this flag for all targets because Clippy checks all of our code against all targets
# and our web code does not compile without this flag
"--cfg=web_sys_unstable_apis",
# CLIPPY LINT SETTINGS
# This is a workaround to configure lints for the entire workspace, pending the ability to configure this via TOML.
# See: https://github.com/rust-lang/cargo/issues/5034
# https://github.com/EmbarkStudios/rust-ecosystem/issues/22#issuecomment-947011395
# TODO: Move these to the root Cargo.toml once support is merged and stable
# See: https://github.com/rust-lang/cargo/pull/12148
# Clippy nightly often adds new/buggy lints that we want to ignore.
# Don't warn about these new lints on stable.
"-Arenamed_and_removed_lints",
"-Aunknown_lints",
# LONG-TERM: These lints are unhelpful.
"-Aclippy::manual_map", # Less readable: Suggests `opt.map(..)` instsead of `if let Some(opt) { .. }`
"-Aclippy::manual_range_contains", # Less readable: Suggests `(a..b).contains(n)` instead of `n >= a && n < b`
]

View File

@ -49,6 +49,17 @@ naga_oil = "0.11.0"
wgpu = "0.18.0"
egui = "0.24.1"
[workspace.lints.rust]
# Clippy nightly often adds new/buggy lints that we want to ignore.
# Don't warn about these new lints on stable.
renamed_and_removed_lints = "allow"
unknown_lints = "allow"
[workspace.lints.clippy]
# LONG-TERM: These lints are unhelpful.
manual_map = "allow" # Less readable: Suggests `opt.map(..)` instsead of `if let Some(opt) { .. }`
manual_range_contains = "allow" # Less readable: Suggests `(a..b).contains(n)` instead of `n >= a && n < b`
# Don't optimize build scripts and macros.
[profile.release.build-override]
opt-level = 0