summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenno Lossin <lossin@kernel.org>2025-08-18 15:18:44 +0200
committerBenno Lossin <lossin@kernel.org>2025-09-11 23:25:54 +0200
commit3d536277449e4de4609d4f0b8302ae7fd00b04b2 (patch)
treef4a911054c99cff87709c5ed0ae5d17bce2235b4
parent8f5ae30d69d7543eee0d70083daf4de8fe15d585 (diff)
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 <lossin@kernel.org>
-rw-r--r--rust/pin-init/examples/error.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/rust/pin-init/examples/error.rs b/rust/pin-init/examples/error.rs
index e0cc258746ce..8f4e135eb8ba 100644
--- a/rust/pin-init/examples/error.rs
+++ b/rust/pin-init/examples/error.rs
@@ -24,4 +24,6 @@ impl From<AllocError> for Error {
}
#[allow(dead_code)]
-fn main() {}
+fn main() {
+ let _ = Error;
+}