The following code will emit a dead_code warning (playground):
use std::mem;
fn main() {
struct Value {
a: i32,
b: i32,
};
let Value { a, b } = unsafe { mem::zeroed() };
println!("{} {}", a, b);
}
It states that Value is never constructed when in fact it has been within the let Value { a, b } pattern match.
Compiling playground v0.0.1 (/playground)
warning: struct is never constructed: `Value`
--> src/main.rs:4:5
|
4 | struct Value {
| ^^^^^^^^^^^^
|
= note: #[warn(dead_code)] on by default
Finished dev [unoptimized + debuginfo] target(s) in 0.90s
Running `target/debug/playground`
The following code will emit a
dead_codewarning (playground):It states that
Valueis never constructed when in fact it has been within thelet Value { a, b }pattern match.