You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Low priority (we will likely not use them in the end)
Conditional compilation for clippy.toml?
No concrete use cases from our side yet; and if needed, we could always handle it on our side generating .clippy.toml on the fly (and using CLIPPY_CONF_DIR to find it in the objtree instead of the srctree).
So far, we have check-private-items enabled, but we do not have all the lints covered enabled, and in the future we might want to enable them, thus check-private-items may make it harder to start.
Lint to catch printing/formatting pointers (including :p and :?).
In Linux, ideally, there would be a way to customize all pointer printing, i.e. including :p and :?, so that we can get them hashed as expected, and thus at that point we wouldn't need to lint for it. Meanwhile, this lint can be useful (and may be for other projects that do not want any printing whatsoever, too).
Macros wrapping expressions in unsafe blocks when using unsafe_op_in_unsafe_fn.
This was eventually handled by clippy::macro_metavars_in_unsafe, which is in suspicious already, so we are already using it and e.g. writing a "bad" container_of! (and using it) does lint for us.
Less false positives in clippy::incompatible_msrv.
We ended up allowing globally clippy::incompatible_msrv early 2026 for Linux v7.1, but it could be nice to eventually use it again (possibly when no more language unstable features remain and/or when the false positives are low enough, since it can be fairly confusing to developers).
We currently do not use cfg(version = "...") but instead our own Kconfig --cfg gates (see "Numerical comparisons in conditional compilation" in Rust wanted features #354).
Low priority (we will likely not use them in the end)
Done (stabilized, fixed, or not needed anymore, etc.)
Fix false positives around undocumented_unsafe_blocks's accept-comment-above-statement.
i.e. that trigger when long statements are split into several lines by e.g. rustfmt.
Originally Clippy didn't support the config option, but eventually it was implemented and then made the default later on. However, there have been false positives around it.
When we introduced the lint in Linux (commit db4f72c ("rust: enable clippy::undocumented_unsafe_blocks lint")), we just put the // SAFETY comment on the previous line, even if it is in the middle of the statement, to workaround it, e.g. see do_unlocked in the commit.
Please see as well:
rustdocwanted features & bugfixes #350 (i.e. some lints may make sense in Clippy, some inrustdoc).feat: add proposed goal for safety-critical lints in Clippy rust-lang/rust-project-goals#483: proposed Rust project goal on safety-critical lints, including potential call graph / cross-crate ones, which would overlap with Klint ones. @nbdd0121 suggests extracting part of the linting infrastructure to a library that projects like Clippy and Klint could use.
Features that we would like to see
Required (we almost certainly want them)
Lint to require
// PANIC: ...comments.// PANICcomment on panic-able calls rust-lang/rust-clippy#15861.// PANIC: ...comments rust-lang/rust-clippy#15895.undocumented_may_panic_calllint rust-lang/rust-clippy#15969.Lint to detect unneeded
// PANIC: ...comments.// PANIC: ...comments rust-lang/rust-clippy#15896.Lint to require
// CAST: ...comments forascasts.// CAST: ...comment onascasts rust-lang/rust-clippy#15963.undocumented_as_castslint rust-lang/rust-clippy#16682.Lint to require
// CAST: ...comments for pointer casts.ascasts.Lint to detect unneeded
// CAST: ...comments.// CAST: ...comments rust-lang/rust-clippy#15964.ascasts and pointer casts.Lint to require
// ORDERING: ...comments for atomic operations (or, more generally, methods that takeOrderingparameters).// ORDERING: ...comment for atomic operations rust-lang/rust-clippy#16073.Lint to detect unneeded
// ORDERING: ...comments.// ORDERING: ...comments rust-lang/rust-clippy#16074.Lint to require
// CALC: ...comments for non-trivial/chained arithmetic operations that do not use the operators.Given a certain threshold of complexity with checked/saturation/... arithmetic, require a math-like expression on top as a comment. For instance:
Ideally, the lint would even check the expression given matches the expanded form below.
Lore: https://lore.kernel.org/rust-for-linux/CANiq72nhzix4Dr9_gbaFwZQQq=3cDY=oAYVgG5hDAmMgaYKQJg@mail.gmail.com/.
Lint to detect unneeded
// CALC: ...comments.Lint to catch
#[no_mangle]on non-repr(C)pub statics.#[no_mangle]for non-repr(C)pub statics rust-lang/rust-clippy#11219.no_mangle_with_rust_abi]: Check for statics with a non#[repr(Rust)]type rust-lang/rust-clippy#11253.#[repr(Rust)]rust-lang/rust#114201 (1.74).Support custom
dbg!s in thedbg_macrolint.dbg!macros fordbg_macrolint rust-lang/rust-clippy#11303.Lint to catch non-absolute paths in macros, e.g.
core::...instead of::core::....relative_path_in_macro_definitionrust-lang/rust-clippy#14472.Lint to catch unnecessary generics like
Result<()>.useless_default_generic_parametersrust-lang/rust-clippy#14848.explicit_default_argumentslint rust-lang/rust-clippy#16123.checkpatch.plissue: SimplifyResult<()>uses and implement acheckpatch.plcheck for it #1128.Support custom
assert*!s for lints likeeq_op.assert_*!macros foreq_op(and possibly others) rust-lang/rust-clippy#14903.Nice to have (not critical, we could workaround if needed, etc.)
Improved shadowing lints.
shadow_*lints. In particular,shadow_reusewould lint on many things that are OK for us, especially "top-level"let ... =s. Please see the details in Lint dangerous uses of shadowing rust-lang/rust-clippy#3433 (comment).Lints that generalize
exit,todo,mem_forget, etc.exit,todo,mem_forget, etc. rust-lang/rust-clippy#8031.disallowed_namessupport for identifiers.disallowed_namesfor identifiers and not just variables rust-lang/rust-clippy#11306.Per-path lint levels for
DisallowedPath-related lints.DisallowedPathrust-lang/rust-clippy#11307.Have a lint against usize-to-u64 casts (or, against all integer casts).
Make
unnecessary_castcover somecore::ffi::c_*cases.unnecessary_cast:core::ffi::c_*cases rust-lang/rust-clippy#13494.unnecessary_castdoes not trigger with a local but it does with a parameter.unnecessary_castfalse negative: parameter vs. local rust-lang/rust-clippy#13495.Ignoring lints added after a given Rust version.
-Dfor some lint groups or leaving Clippy's default for some lints inclippy::all.Unsafe attributes support.
undocumented_unsafe_blocks) rust-lang/rust-clippy#13316.unnecessary_safety_comment) rust-lang/rust-clippy#13317.Avoid inherent methods on generic smart pointers.
Split
needless_lifetimes.clippy::alllint that weallow.needless_lifetimesinto cases that do and do not require'_rust-lang/rust-clippy#13514.Support for
--fixwithout Cargo (e.g. insideclippy-driver).cargo(the binary) would be fine if needed, but not if it requires a Cargo-based structure.unsafe externsupport.unsafe externsupport (undocumented_unsafe_blocks?) rust-lang/rust-clippy#13560.Unneeded
rustas language inrustdoc's documentation examples.rustas language inrustdoc's documentation examples rust-lang/rust-clippy#13604.manual_div_ceilsuggests change that could alter behaviour.manual_div_ceilsuggests change that could alter behaviour rust-lang/rust-clippy#14333.Lint to catch docs using
///instead of//!.///instead of//!rust-lang/rust-clippy#14402.Support
msrvwith a list of unstable features to assume (or perhaps a list of lints that ignore themsrvfield).#[feature]awareness in MSRV-gated lints rust-lang/rust-clippy#14477.Lint to catch links in normal comments (i.e.
//) that are not formatted as Markdown autolinks (i.e.<https://...>).rustdocin general, like the wish for intra-doc links there?Lint to detect unindented triple backquotes in the end of examples.
Lint to detect code block contents without "base indentation" in docs.
Lint to detect extra "base indentation" in Rust code blocks.
Lint to detect inconsistent "style" for safety-related docs/comments.
unnecessary_safety_commentinconsistency with wrong-style safety section rust-lang/rust-clippy#15034.Lint to detect
//within///(only when the empty comment is empty).//within///") rust-lang/rust-clippy#15245.comment_within_doclint rust-lang/rust-clippy#15260.Lint to disallow imports of certain items (to force users to write e.g.
ordering::Any).wildcard_imports'sallowed-wildcard-importswith several path segments.wildcard_imports'sallowed-wildcard-importswith several path segments rust-lang/rust-clippy#15246.manual_is_multiple_ofsuggests change that could alter behaviour.manual_is_multiple_ofsuggests change that could alter behaviour rust-lang/rust-clippy#15335.Providing information about integer type aliases with multiple sizes.
Low priority (we will likely not use them in the end)
Conditional compilation for
clippy.toml?.clippy.tomlon the fly (and usingCLIPPY_CONF_DIRto find it in theobjtreeinstead of thesrctree).Fine-grained
check-private-items(https://doc.rust-lang.org/clippy/lint_configuration.html#check-private-items).check-private-itemsenabled, but we do not have all the lints covered enabled, and in the future we might want to enable them, thuscheck-private-itemsmay make it harder to start.check-private-itemsconfiguration for different lints rust-lang/rust-clippy#13074.Done (stabilized, fixed, not needed anymore, etc.)
Overindented lines lint (similar to
doc_lazy_continuation).doc_lazy_continuation) rust-lang/rust-clippy#13601.doc_overindented_list_itemsrust-lang/rust-clippy#13711 (1.86).Support/document running Clippy as a
rustcwrapper.Configuring lint levels when using
clippy-driver.clippy-driverrust-lang/rust-clippy#6799.Normalize semicolon inside/outside blocks for
()returning expressions (semicolon_outside_blockandsemicolon_inside_block, 1.68.0).()returning expressions rust-lang/rust-clippy#7322.Lint to warn about missing
// SAFETY:explanations (undocumented_unsafe_blocks, 1.58.0).unsafeblocks to have comments explaining why the required invariants hold rust-lang/rust-clippy#9330.Lint to warn about unexpected
# Safetycontracts (i.e. the reverse of themissing_safety_doclint) (unnecessary_safety_doc, 1.67.0).unnecessary_safety_doclint rust-lang/rust-clippy#9822.Lint to warn about unexpected
// SAFETY:comments (i.e. the reverse of theundocumented_unsafe_blockslint) (unnecessary_safety_comment, 1.67.0).unnecessary_safety_comment): reverse ofundocumented_unsafe_blocksrust-lang/rust-clippy#7954.// SAFETY:comments also for explaining why safe code makes other unsafe code sound, though.Lint to catch
#[no_mangle]but non-extern "C"(no_mangle_with_rust_abi, 1.69.0).Lint to catch printing/formatting pointers (including
:pand:?).:pand:?, so that we can get them hashed as expected, and thus at that point we wouldn't need to lint for it. Meanwhile, this lint can be useful (and may be for other projects that do not want any printing whatsoever, too).Macros wrapping expressions in
unsafeblocks when usingunsafe_op_in_unsafe_fn.clippy::macro_metavars_in_unsafe, which is insuspiciousalready, so we are already using it and e.g. writing a "bad"container_of!(and using it) does lint for us.unsafeblocks when usingunsafe_op_in_unsafe_fnrust-lang/rust-clippy#7323.macros_hiding_unsafe_coderust-lang/rust-clippy#7469.macro_metavars_in_unsaferust-lang/rust-clippy#12107 (1.80).Lint to suggest
cast_signedandcast_unsigned(added suggestion tocast_possible_wrapandcast_sign_loss).cast_signedandcast_unsignedinstead ofasrust-lang/rust-clippy#14974.cast_sign_lossandcast_possible_wrapusing thecast_{un,}signed()methods rust-lang/rust-clippy#15384 (1.92).Support custom
format!macros (#[clippy::format_args]attribute).Bugs that we would like to see fixed
Required (we almost certainly want them)
disallowed_macrosfalse negatives.dbg_macroemulation purposes.disallowed_macrosfalse negatives rust-lang/rust-clippy#11431.$t + $tcase): Check binary operators and attributes in disallowed_macros rust-lang/rust-clippy#11439 (1.74).cast_losslessfalse negative onchar as u32.cast_losslessnot triggered bychar as u32rust-lang/rust-clippy#14469.cast_lossless: lint when convertingusize,isize,charand float as well rust-lang/rust-clippy#14470.Nice to have (probably not critical, we could workaround if needed, etc.)
unnecessary_safety_commentdoes not lint for "orphan" comments.unnecessary_safety_commentdoes not lint for "orphan" comments rust-lang/rust-clippy#14556.unnecessary_safety_commentinconsistency with wrong-style safety section.unnecessary_safety_commentinconsistency with wrong-style safety section rust-lang/rust-clippy#15034.Feedback on
needless_continuein Rust 1.86.0 (which we will probably disable globally).needless_continuein Rust 1.86 rust-lang/rust-clippy#14536.Less false positives in
clippy::incompatible_msrv.clippy::incompatible_msrvearly 2026 for Linux v7.1, but it could be nice to eventually use it again (possibly when no more language unstable features remain and/or when the false positives are low enough, since it can be fairly confusing to developers).cfg(version = "...")but instead our own Kconfig--cfggates (see "Numerical comparisons in conditional compilation" in Rust wanted features #354).Low priority (we will likely not use them in the end)
Done (stabilized, fixed, or not needed anymore, etc.)
README: document that Clippy may change codegen.clippy-driverbe always used as replacement ofrustc? rust-lang/rust-clippy#8035.README: document that Clippy may change codegen rust-lang/rust-clippy#8037 (1.60).new_ret_no_selffalse positive when returningimpl Trait<Self>.pin-initusage.new_ret_no_selffalse positive when returningimpl Trait<Self>rust-lang/rust-clippy#7344.macro_metavars_in_unsafefalse negative without statement.macro_metavars_in_unsafedoes not lint "without a statement". rust-lang/rust-clippy#13219.macro_metavars_in_unsafe]: recognize metavariables in tail expressions rust-lang/rust-clippy#13220 (1.82?).single_matchdifference in 1.85.0 -- is it intended?expectin https://lore.kernel.org/rust-for-linux/20250122054719.595878-1-dirk.behme@de.bosch.com/.clippy::single_matchdoes not report if a comment is on top of an arm rust-lang/rust-clippy#14418.single_match/single_match_elselints with comments rust-lang/rust-clippy#14420 (1.87?).Diagnostic for unexpected paths in configuration file.
disallowed_macros's paths.disallowed_*configurations rust-lang/rust-clippy#14397 (1.87?).Reduce or split
ptr_eq.allowit globally otherwise, likeneedless_continue.needless_continuein Rust 1.86 rust-lang/rust-clippy#14536.ptr_eqtriggers rust-lang/rust-clippy#14526.allowed a few of them (when applied): https://lore.kernel.org/rust-for-linux/20250502140237.1659624-3-ojeda@kernel.org/.undocumented_unsafe_blocksfalse positives around attributes.undocumented_unsafe_blocksfalse positives around attributes rust-lang/rust-clippy#13189.accept-comment-above-attributesto statements rust-lang/rust-clippy#15213 (1.90).Fix false positives around
undocumented_unsafe_blocks'saccept-comment-above-statement.rustfmt.clippy::undocumented_unsafe_blockslint")), we just put the// SAFETYcomment on the previous line, even if it is in the middle of the statement, to workaround it, e.g. seedo_unlockedin the commit.undocumented_unsafe_blockscan be broken byrustfmtrust-lang/rust-clippy#13024.undocumented_unsafe_blocksFP on trait/impl items rust-lang/rust-clippy#13888 (1.87).Avoid
clippy::incompatible_msrvfor features enabled.incompatible_msrvlint rust-lang/rust-clippy#14433 (1.90).unnecessary_safety_commentdoes not lint for the first line.unnecessary_safety_commentdoes not lint for the first line rust-lang/rust-clippy#14553.unnecessary_safety_commentdoes not lint for the first line rust-lang/rust-clippy#15354 (1.91).unnecessary_safety_commentdoes not lint the first item of a module without a body.unnecessary_safety_commentdoes not lint the first item of a module without a body rust-lang/rust-clippy#14554.unnecessary_safety_commentdoes not lint for the first line rust-lang/rust-clippy#15354 (1.91).unnecessary_safety_commentdoes not lint for adoc(hidden)item.unnecessary_safety_commentdoes not lint for adoc(hidden)item rust-lang/rust-clippy#14555.unnecessary_safety_comment] Some fixes regarding comments above attributes rust-lang/rust-clippy#15678 (1.92).declare_interior_mutable_constfires for static pointer types (warning: aconstitem should not be interior mutable).non_copy_construst-lang/rust-clippy#13207 (1.89).declare_interior_mutable_const: Ignore pointer types. rust-lang/rust-clippy#13290 (1.82).clippy::double_parensfalse positive.clippy::precedence"false positives" (with respect to later versions).clippy::precedenceinto multiple lints rust-lang/rust-clippy#14097 (i.e. started in Rust 1.85.0).precedence_bits, with recent additions toprecedencerust-lang/rust-clippy#14115 (1.86.0).