Description
Features that we would like to see
Required (we almost certainly want them)
-
Macros wrapping expressions in
unsafe
blocks when usingunsafe_op_in_unsafe_fn
.- Issue: Macros wrapping expressions in
unsafe
blocks when usingunsafe_op_in_unsafe_fn
rust-lang/rust-clippy#7323. - Unfinished PR: Add new lint
macros_hiding_unsafe_code
rust-lang/rust-clippy#7469. - Related: Rust 1.80.0's
clippy::macro_metavars_in_unsafe
.
- Issue: Macros wrapping expressions in
-
Lint to catch
#[no_mangle]
on non-repr(C)
pub static
s. -
Support custom
dbg!
s in thedbg_macro
lint.- We started using it in Rust 1.60, but it stopped working in 1.61 (but it may be intended).
- Issue: Custom
dbg!
macros fordbg_macro
lint rust-lang/rust-clippy#11303.
-
Lint to catch non-absolute paths in macros, e.g.
core::...
instead of::core::...
.- Issue: New lint:
relative_path_in_macro_definition
rust-lang/rust-clippy#14472. - PR: Add relative_path_in_macro_definition lint (#14472) #14645 rust-lang/rust-clippy#14648.
- PR: Add relative_path_in_macro_definition lint (#14472) rust-lang/rust-clippy#14645.
- Lore: https://lore.kernel.org/rust-for-linux/[email protected]/.
- Issue: New lint:
-
Lint to catch unnecessary generics like
Result<()>
.
Nice to have (not critical, we could workaround if needed, etc.)
-
Improved shadowing lints.
- We currently do not enable any of the
shadow_*
lints. In particular,shadow_reuse
would 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). - It would have already prevented one kernel bug: https://lore.kernel.org/rust-for-linux/[email protected]/.
- Issue: Lint dangerous uses of shadowing rust-lang/rust-clippy#3433.
- Issue: Lint request: warn when variable declared in match pattern shadows other variable rust-lang/rust-clippy#2890.
- We currently do not enable any of the
-
Lints that generalize
exit
,todo
,mem_forget
, etc. -
disallowed_names
support for identifiers. -
Per-path lint levels for
DisallowedPath
-related lints. -
Have a lint against usize-to-u64 casts (or, against all integer casts).
-
Make
unnecessary_cast
cover somecore::ffi::c_*
cases. -
unnecessary_cast
does not trigger with a local but it does with a parameter. -
Ignoring lints added after a given Rust version.
- Issue: Ignoring lints added after a given Rust version rust-lang/rust-clippy#11227.
- Related: New lints are not backwards compatible rust-lang/cargo#12495 (about ignoring unknown lints, explicitly passed, when compiling with an older compiler, rather than a new compiler introducing new lints).
- If we had something like this, then we could consider using
-D
for some lint groups or leaving Clippy's default for some lints inclippy::all
.
-
Unsafe attributes support.
-
Avoid inherent methods on generic smart pointers.
-
Split
needless_lifetimes
.- One "major addition" to the lint added in 1.86.
- Currently it is the only
clippy::all
lint that weallow
. - Issue: Consider splitting
needless_lifetimes
into cases that do and do not require'_
rust-lang/rust-clippy#13514. - Lore: https://lore.kernel.org/rust-for-linux/[email protected]/.
- Lore: https://lore.kernel.org/rust-for-linux/[email protected]/.
-
Support for
--fix
without Cargo (e.g. insideclippy-driver
).- Using
cargo
(the binary) would be fine if needed, but not if it requires a Cargo-based structure.
- Using
-
unsafe extern
support. -
Unneeded
rust
as language inrustdoc
's documentation examples. -
manual_div_ceil
suggests change that could alter behaviour. -
Lint to catch docs using
///
instead of//!
.- Issue: Documentation mistakenly using
///
instead of//!
rust-lang/rust-clippy#14402. - Example: 8d9b095 ("samples: rust_misc_device: Provide an example C program to exercise functionality").
- Issue: Documentation mistakenly using
-
Support
msrv
with a list of unstable features to assume (or perhaps a list of lints that ignore themsrv
field). -
Lint to catch links in normal comments (i.e.
//
) that are not formatted as Markdown autolinks (i.e.<https://...>
).- Should lints like these be part of
rustdoc
in general, like the wish for intra-doc links there? - Rust for Linux example issue to clean instances of these: Use Markdown autolinks in normal comments #1153.
- Should lints like these be part of
-
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). - Issue: new restriction lint: pointer_format rust-lang/rust-clippy#14792.
- Zulip: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Clippy.20lint.20for.20detecting.20pointer.20printing/near/517813625.
- In Linux, ideally, there would be a way to customize all pointer printing, i.e. including
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 usingCLIPPY_CONF_DIR
to find it in theobjtree
instead of thesrctree
). - Issue: Conditional compilation for configuration file? rust-lang/rust-clippy#11433.
- No concrete use cases from our side yet; and if needed, we could always handle it on our side generating
-
Fine-grained
check-private-items
(https://doc.rust-lang.org/clippy/lint_configuration.html#check-private-items).- 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, thuscheck-private-items
may make it harder to start. - Issue: Separate
check-private-items
configuration for different lints rust-lang/rust-clippy#13074.
- So far, we have
Done (stabilized, fixed, not needed anymore, etc.)
-
Overindented lines lint (similar to
doc_lazy_continuation
). -
Support/document running Clippy as a
rustc
wrapper. -
Configuring lint levels when using
clippy-driver
. -
Normalize semicolon inside/outside blocks for
()
returning expressions (semicolon_outside_block
andsemicolon_inside_block
, 1.68.0). -
Lint to warn about missing
// SAFETY:
explanations (undocumented_unsafe_blocks
, 1.58.0). -
Lint to warn about unexpected
# Safety
contracts (i.e. the reverse of themissing_safety_doc
lint) (unnecessary_safety_doc
, 1.67.0). -
Lint to warn about unexpected
// SAFETY:
comments (i.e. the reverse of theundocumented_unsafe_blocks
lint) (unnecessary_safety_comment
, 1.67.0).- Issue: New lint (
unnecessary_safety_comment
): reverse ofundocumented_unsafe_blocks
rust-lang/rust-clippy#7954. - PR: Lint unnecessary safety comments rust-lang/rust-clippy#9851.
- Unclear if we will use
// SAFETY:
comments also for explaining why safe code makes other unsafe code sound, though.
- Issue: New lint (
-
Lint to catch
#[no_mangle]
but non-extern "C"
(no_mangle_with_rust_abi
, 1.69.0).
Bugs that we would like to see fixed
Required (we almost certainly want them)
-
undocumented_unsafe_blocks
false positives around attributes.- Workaround: moving the attribute on top always fixes it.
- Workaround: where it makes sense, moving the comment inside the expression, also works.
- Issue:
undocumented_unsafe_blocks
false positives around attributes rust-lang/rust-clippy#13189.
-
disallowed_macros
false negatives.- For
dbg_macro
emulation purposes. - Issue:
disallowed_macros
false negatives rust-lang/rust-clippy#11431. - PR (for the
$t + $t
case): Check binary operators and attributes in disallowed_macros rust-lang/rust-clippy#11439 (1.74).
- For
-
cast_lossless
false negative onchar as u32
.
Nice to have (probably not critical, we could workaround if needed, etc.)
-
unnecessary_safety_comment
does not lint for the first line. -
unnecessary_safety_comment
does not lint the first item of a module without a body. -
unnecessary_safety_comment
does not lint for a doc(hidden) item. -
unnecessary_safety_comment
does not lint for "orphan" comments. -
Feedback on
needless_continue
in Rust 1.86.0 (which we will probably disable globally).
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. -
new_ret_no_self
false positive when returningimpl Trait<Self>
. -
macro_metavars_in_unsafe
false negative without statement. -
single_match
difference in 1.85.0 -- is it intended? -
Diagnostic for unexpected paths in configuration file.
- For instance, for
disallowed_macros
's paths. - Issue: Diagnostic for unexpected paths in configuration file rust-lang/rust-clippy#11432.
- PR: Validate paths in
disallowed_*
configurations rust-lang/rust-clippy#14397 (1.87?).
- For instance, for
-
Reduce or split
ptr_eq
.- One "major addition" to the lint (linting all pointer comparisons) added in 1.87.
- We may need to
allow
it globally otherwise, likeneedless_continue
. - Issue: Feedback on
needless_continue
in Rust 1.86 rust-lang/rust-clippy#14536. - Issue: clippy beta 1.87 lints all pointer comparisons, possibly too much? rust-lang/rust-clippy#14525.
- PR: Restrict the cases where
ptr_eq
triggers rust-lang/rust-clippy#14526. - Backport PR (for Rust 1.87): [beta] Clippy beta backport rust-lang/rust#140810, [stable] Prepare the 1.87.0 release rust-lang/rust#140859.
- Patch that
allow
ed a few of them (when applied): https://lore.kernel.org/rust-for-linux/[email protected]/.