Commit 3d536277 authored by Benno Lossin's avatar Benno Lossin
Browse files

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: default avatarBenno Lossin <lossin@kernel.org>
parent 8f5ae30d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -24,4 +24,6 @@ fn from(_: AllocError) -> Self {
}

#[allow(dead_code)]
fn main() {}
fn main() {
    let _ = Error;
}