Re: [PATCH v9 0/2] modularize Rust lints and add RUST_UNWRAP check
From: Dirk Behme
Date: Sat Feb 14 2026 - 01:14:44 EST
Hi Jason and Miguel,
On 07.02.26 23:49, Jason Hall wrote:
...
> The second patch introduces the RUST_UNWRAP lint, which warns against
> the use of .unwrap() and .expect() unless they are accompanied by a
> '// PANIC:' justification comment.
While some further thinking about the discussion in this thread I'm
under the impression that going this way somehow leaves us unhappy.
Either it becomes complicated (again, many thanks to Jason for working
on this!) or we will end up with several limitations and (confusing?)
false positives.
I wonder if it would be an option to change the strategy here?
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.
Best regards
Dirk