[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250905133401.3312707-2-lossin@kernel.org>
Date: Fri, 5 Sep 2025 15:33:58 +0200
From: Benno Lossin <lossin@...nel.org>
To: Benno Lossin <lossin@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Andreas Hindborg <a.hindborg@...nel.org>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
Danilo Krummrich <dakr@...nel.org>,
Fiona Behrens <me@...enk.dev>
Cc: rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] 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.
Link: https://github.com/Rust-for-Linux/pin-init/pull/79/commits/1f4f749b5b151d0dfdf9672af323e39a33e920fd
Signed-off-by: Benno Lossin <lossin@...nel.org>
---
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 e0cc258746ce..8f4e135eb8ba 100644
--- a/rust/pin-init/examples/error.rs
+++ b/rust/pin-init/examples/error.rs
@@ -24,4 +24,6 @@ fn from(_: AllocError) -> Self {
}
#[allow(dead_code)]
-fn main() {}
+fn main() {
+ let _ = Error;
+}
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
--
2.50.1
Powered by blists - more mailing lists