rust/tests/ui/lint/dead-code/unused-struct-derive-default.rs
2024-08-03 07:57:31 -04:00

26 lines
432 B
Rust

#![deny(dead_code)]
#[derive(Default)]
struct T; //~ ERROR struct `T` is never constructed
#[derive(Default)]
struct Used;
#[derive(Default)]
enum E {
#[default]
A,
B, //~ ERROR variant `B` is never constructed
}
// external crate can call T2::default() to construct T2,
// so that no warnings for pub adts
#[derive(Default)]
pub struct T2 {
_unread: i32,
}
fn main() {
let _x: Used = Default::default();
}