Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+3 -1
+3 -1
rust/pin-init/examples/error.rs
··· 24 24 } 25 25 26 26 #[allow(dead_code)] 27 - fn main() {} 27 + fn main() { 28 + let _ = Error; 29 + }