From: Benno Lossin Date: Mon, 18 Aug 2025 13:18:44 +0000 (+0200) Subject: rust: pin-init: examples: error: use `Error` in `fn main()` X-Git-Tag: v6.18-rc1~134^2~7^2~10^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3d536277449e4de4609d4f0b8302ae7fd00b04b2;p=thirdparty%2Flinux.git rust: pin-init: examples: error: use `Error` in `fn main()` When running this example with no cargo features enabled, the compiler warns on 1.89: error: struct `Error` is never constructed --> examples/error.rs:11:12 | 11 | pub struct Error; | ^^^^^ | = note: `-D dead-code` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(dead_code)]` Thus use the error in the main function to avoid this warning. Signed-off-by: Benno Lossin --- diff --git a/rust/pin-init/examples/error.rs b/rust/pin-init/examples/error.rs index e0cc258746ce5..8f4e135eb8ba5 100644 --- a/rust/pin-init/examples/error.rs +++ b/rust/pin-init/examples/error.rs @@ -24,4 +24,6 @@ impl From for Error { } #[allow(dead_code)] -fn main() {} +fn main() { + let _ = Error; +}