Re: [PATCH] rust: soc: silence clippy warning with rustc >= 1.88
From: Gary Guo
Date: Tue Jul 07 2026 - 10:47:19 EST
On Tue Jul 7, 2026 at 3:19 PM BST, Alexandre Courbot wrote:
> On Tue Jul 7, 2026 at 9:12 PM JST, Miguel Ojeda wrote:
>> On Tue, Jul 7, 2026 at 1:43 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>>>
>>> We set `msrv = "1.85"` in our .clippy.toml, and my local testing with 1.88 and
>>> 1.96.1 doesn't produce this warning.
>>
>> Yeah, I was trying to reproduce it locally too and didn't succeed yet.
>
> Ok so this is nuts but it appears to only reproduce when
> `CONFIG_CC_OPTIMIZE_FOR_SIZE=y` (and `CONFIG_SAMPLE_RUST_SOC=m` to build
> `soc.rs`)
That's crazy. Turns out that clippy's default equivalent check relies on MIR:
https://github.com/rust-lang/rust-clippy/blob/60f8c3a019cfda37e07de60e9cfd7ee77b290fb5/clippy_utils/src/lib.rs#L570
and somehow this check misses `null()` when opt level is high enough. There
isn't a check for MSRV in the trait impl.
Please report a clippy bug.
Best,
Gary