Re: [PATCH v9 0/2] modularize Rust lints and add RUST_UNWRAP check
From: Miguel Ojeda
Date: Sat Feb 14 2026 - 18:31:14 EST
On Sat, Feb 14, 2026 at 7:11 AM Dirk Behme <dirk.behme@xxxxxxxxx> wrote:
>
> In the last time we have introduced several rules by "convention".
> Without checkpatch or lint support. Like "please use vertical style
> for imports", "please use `__rust_helper` for helpers" or "please drop
> `as_ref` from dev_* prints". Would it be an (easier?) option to go the
> same way here? Instead of enforcing it with checkpatch?
>
> I'm thinking about the same approach like we did with the examples
> above: We identify the "wrong" `unwrap()` usages in the existing code
> and "fix" them with patches. What would result in a clean code base.
> At the same time it will give developers an indication that the
> remaining ones are "allowed" ones which are ok. And for new code in
> the review we ask for corrections if we spot a "wrong" usage.
[ To give some context, in case it helps further discussion... ]
Yeah, that is the status quo, i.e. catching it during review
(depending on whether it is an acceptable case or not etc.).
However, there were concerns that now that more and more Rust is
getting into the kernel, with more contributors and subsystems
participating at the same time, we would eventually see `unwrap()`s
and so on proliferating here and there, i.e. that things would slip
through.
So after some discussion, we settled on asking for the Clippy lint
upstream plus a `checkpatch.pl` warning meanwhile / on top of. Thus I
filled the respective issues:
https://github.com/Rust-for-Linux/linux/issues/1191
https://github.com/rust-lang/rust-clippy/issues/15895 (switched to
Alejandra's earlier
https://github.com/rust-lang/rust-clippy/issues/15861).
https://github.com/rust-lang/rust-clippy/issues/15896
The Clippy one would be the end goal, if we can get it to work well,
while `checkpatch.pl` would serve a similar role to the C side warning
for `BUG_ON()` (and friends).
Cheers,
Miguel