Skip to content

replace rustflags with [lints] #837

@OmarTawfik

Description

@OmarTawfik

https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html#lint-configuration-through-cargo

[build]
# TODO: Replace with `[lints]` once we upgrade to Rust 1.74
# https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html#lint-configuration-through-cargo
rustflags = [
# rustc additional warnings:
"-Wunused_crate_dependencies",
"-Wunused_lifetimes",
"-Wunused_macro_rules",
"-Wunused_tuple_struct_fields", # Will be uplifed into `dead_code` (warn-by-default) with https://github.com/rust-lang/rust/pull/118297
"-Wmeta_variable_misuse",
# Rust 2018 idioms that are not yet warn-by-default:
"-Welided_lifetimes_in_paths",
"-Wunused_extern_crates",
"-Wexplicit_outlives_requirements",
# 📎 Lints that are enabled (warn/deny) by default
"-Wclippy::all",
# Cargo
"-Wclippy::cargo", # Warn about Cargo.toml issues, except...
"-Aclippy::multiple_crate_versions", # Not possible to deduplicate, should be done periodically ourselves
# Restriction (optional, neutral lints)
"-Wclippy::exit", # Prefer not `process::exit`ing directly
"-Wclippy::rest_pat_in_fully_bound_structs", # Prefer not to use `..` in fully bound structs
"-Wclippy::verbose_file_reads", # Prefer simpler and more concise `fs::read_to_string`
# Pedantic
"-Wclippy::pedantic", # Warn about pedantic lints, except...
"-Aclippy::implicit_clone", # A lot of false positives, tuned down in Clippy bundled with Rust 1.73
"-Aclippy::match_same_arms", # It's often clearer to have the same arm twice
"-Aclippy::missing_errors_doc", # Most of our code is internal; let's not clutter the docs until...
"-Aclippy::missing_panics_doc", # ... we care about the public documentation in our shipped crates
"-Aclippy::module_name_repetitions", # It seems we prefer it this way; we'd need to discuss that
"-Aclippy::must_use_candidate", # Overzealous, we'd have to `[must_use]` a lot of things
"-Aclippy::redundant_closure_for_method_calls", # Not always clearer, let's not pepper `allow`s whenever needed
# Nursery
"-Wclippy::collection_is_never_read", # Lint against collections not used after creation
"-Wclippy::equatable_if_let", # Prefer regular `==` checks over Yoda `if let $pat = $value`
"-Wclippy::useless_let_if_seq", # Use idiomatic direct assignment of `let $val = if $cond { .. } else { ..};`
]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions