rustc
has the concept of a "lint group", where you can toggle several warnings
through one name.
For example, the nonstandard-style
lint sets non-camel-case-types
,
non-snake-case
, and non-upper-case-globals
all at once. So these are
equivalent:
$ rustc -D nonstandard-style
$ rustc -D non-camel-case-types -D non-snake-case -D non-upper-case-globals
Here's a list of each lint group, and the lints that they are made up of:
Group | Description | Lints |
warnings | All lints that are set to issue warnings | See warn-by-default for the default set of warnings |
deprecated-safe | Lints for functions which were erroneously marked as safe in the past | deprecated-safe-2024 |
future-incompatible | Lints that detect code that has future-compatibility problems | ambiguous-associated-items, ambiguous-glob-imports, cenum-impl-drop-cast, coherence-leak-check, conflicting-repr-hints, const-evaluatable-unchecked, dependency-on-unit-never-type-fallback, deref-into-dyn-supertrait, elided-lifetimes-in-associated-constant, forbidden-lint-groups, ill-formed-attribute-input, invalid-type-param-default, late-bound-lifetime-arguments, legacy-derive-helpers, macro-expanded-macro-exports-accessed-by-absolute-paths, missing-fragment-specifier, never-type-fallback-flowing-into-unsafe, order-dependent-trait-objects, out-of-scope-macro-calls, patterns-in-fns-without-body, proc-macro-derive-resolution-fallback, ptr-cast-add-auto-to-object, pub-use-of-private-extern-crate, repr-transparent-external-private-fields, self-constructor-from-outer-item, semicolon-in-expressions-from-macros, soft-unstable, uncovered-param-in-projection, uninhabited-static, unstable-name-collisions, unstable-syntax-pre-expansion, unsupported-fn-ptr-calling-conventions, wasm-c-abi |
keyword-idents | Lints that detect identifiers which will be come keywords in later editions | keyword-idents-2018, keyword-idents-2024 |
let-underscore | Lints that detect wildcard let bindings that are likely to be invalid | let-underscore-drop, let-underscore-lock |
nonstandard-style | Violation of standard naming conventions | non-camel-case-types, non-snake-case, non-upper-case-globals |
refining-impl-trait | Detects refinement of impl Trait return types by trait implementations | refining-impl-trait-internal, refining-impl-trait-reachable |
rust-2018-compatibility | Lints used to transition code from the 2015 edition to 2018 | absolute-paths-not-starting-with-crate, anonymous-parameters, keyword-idents-2018, tyvar-behind-raw-pointer |
rust-2018-idioms | Lints to nudge you toward idiomatic features of Rust 2018 | bare-trait-objects, elided-lifetimes-in-paths, ellipsis-inclusive-range-patterns, explicit-outlives-requirements, unused-extern-crates |
rust-2021-compatibility | Lints used to transition code from the 2018 edition to 2021 | array-into-iter, bare-trait-objects, ellipsis-inclusive-range-patterns, non-fmt-panics, rust-2021-incompatible-closure-captures, rust-2021-incompatible-or-patterns, rust-2021-prefixes-incompatible-syntax, rust-2021-prelude-collisions |
rust-2024-compatibility | Lints used to transition code from the 2021 edition to 2024 | boxed-slice-into-iter, deprecated-safe-2024, edition-2024-expr-fragment-specifier, if-let-rescope, impl-trait-overcaptures, keyword-idents-2024, missing-unsafe-on-extern, rust-2024-guarded-string-incompatible-syntax, rust-2024-incompatible-pat, rust-2024-prelude-collisions, static-mut-refs, tail-expr-drop-order, unsafe-attr-outside-unsafe, unsafe-op-in-unsafe-fn |
unused | Lints that detect things being declared but not used, or excess syntax | dead-code, map-unit-fn, path-statements, redundant-semicolons, unreachable-code, unreachable-patterns, unused-allocation, unused-assignments, unused-attributes, unused-braces, unused-doc-comments, unused-extern-crates, unused-features, unused-imports, unused-labels, unused-macro-rules, unused-macros, unused-must-use, unused-mut, unused-parens, unused-unsafe, unused-variables |
Additionally, there's a bad-style
lint group that's a deprecated alias for nonstandard-style
.
Finally, you can also see the table above by invoking rustc -W help
. This will give you the exact values for the specific
compiler you have installed.