diff options
| author | Miguel Ojeda <[email protected]> | 2025-04-29 21:06:29 +0000 |
|---|---|---|
| committer | Danilo Krummrich <[email protected]> | 2025-04-29 21:45:54 +0000 |
| commit | fc55584e00fc8409cbaef4bcd984016dca6f1b6b (patch) | |
| tree | 9ca7df228bcbbdd6333498b058a77851cbf6c738 /samples/rust/rust_driver_pci.rs | |
| parent | MAINTAINERS: add DRM Rust source files to DRM DRIVERS (diff) | |
| download | kernel-fc55584e00fc8409cbaef4bcd984016dca6f1b6b.tar.gz kernel-fc55584e00fc8409cbaef4bcd984016dca6f1b6b.zip | |
rust: device: conditionally expect `dead_code` for `parent()`
When `CONFIG_AUXILIARY_BUS` is disabled, `parent()` is still dead code:
error: method `parent` is never used
--> rust/kernel/device.rs:71:19
|
64 | impl<Ctx: DeviceContext> Device<Ctx> {
| ------------------------------------ method in this implementation
...
71 | pub(crate) fn parent(&self) -> Option<&Self> {
| ^^^^^^
|
= note: `-D dead-code` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(dead_code)]`
Thus reintroduce the `expect`, but now as a conditional one. Do so as
`dead_code` since that is narrower.
An `allow` would also be possible, but Danilo wants to catch new users
in the future [1].
Link: https://lore.kernel.org/rust-for-linux/aBE8qQrpXOfru_K3@pollux/ [1]
Fixes: ce735e73dd59 ("rust: auxiliary: add auxiliary device / driver abstractions")
Signed-off-by: Miguel Ojeda <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Adjust commit subject to "rust: device: conditionally expect
`dead_code` for `parent()`". - Danilo ]
Signed-off-by: Danilo Krummrich <[email protected]>
Diffstat (limited to 'samples/rust/rust_driver_pci.rs')
0 files changed, 0 insertions, 0 deletions
