From 3d536277449e4de4609d4f0b8302ae7fd00b04b2 Mon Sep 17 00:00:00 2001 From: Benno Lossin Date: Mon, 18 Aug 2025 15:18:44 +0200 Subject: [PATCH] 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 --- rust/pin-init/examples/error.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; +} -- 2.47.3