Re: [PATCH] rust: auxiliary: fix false positive warning for missing a safety comment
From: Danilo Krummrich
Date: Tue Nov 04 2025 - 19:31:34 EST
On Mon Nov 3, 2025 at 9:39 PM CET, Danilo Krummrich wrote:
> Some older (yet supported) versions of clippy throw a false positive
> warning for missing a safety comment when the safety comment is on a
> multiline statement.
>
> warning: unsafe block missing a safety comment
> --> rust/kernel/auxiliary.rs:351:22
> |
> 351 | Self(unsafe { NonNull::new_unchecked(adev) }),
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: consider adding a safety comment on the preceding line
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#undocumented_unsafe_blocks
> = note: requested on the command line with `-W clippy::undocumented-unsafe-blocks`
>
> warning: 1 warning emitted
>
> Fix this by placing the safety comment right on top of the same line
> introducing the unsafe block.
>
> Fixes: e4e679c8608e ("rust: auxiliary: unregister on parent device unbind")
> Signed-off-by: Danilo Krummrich <dakr@xxxxxxxxxx>
Applied to driver-core-testing, thanks!