rust/tests/ui/unit_like_struct_brackets.rs

24 lines
530 B
Rust
Raw Normal View History

2022-03-27 07:16:08 -05:00
// run-rustfix
#![warn(clippy::unit_like_struct_brackets)]
#![allow(dead_code)]
2022-03-27 07:41:09 -05:00
pub struct MyEmptyStruct {} // should trigger lint
struct MyEmptyTupleStruct(); // should trigger lint
2022-03-27 07:16:08 -05:00
// should not trigger lint
struct MyCfgStruct {
#[cfg(feature = "thisisneverenabled")]
field: u8,
}
// should not trigger lint
struct MyCfgTupleStruct(#[cfg(feature = "thisisneverenabled")] u8);
// should not trigger lint
2022-03-27 07:41:09 -05:00
struct MyStruct {
2022-03-27 07:16:08 -05:00
field: u8,
}
2022-03-27 07:41:09 -05:00
struct MyTupleStruct(usize, String); // should not trigger lint
2022-03-27 07:16:08 -05:00
fn main() {}