Skip to content

Commit 1f4f749

Browse files
committed
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 <[email protected]>
1 parent 6793b8a commit 1f4f749

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ impl From<AllocError> for Error {
2424
}
2525

2626
#[allow(dead_code)]
27-
fn main() {}
27+
fn main() {
28+
let _ = Error;
29+
}

0 commit comments

Comments
 (0)