mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
40 lines
693 B
Rust
40 lines
693 B
Rust
#[allow(clippy::unnecessary_operation, clippy::single_match)]
|
|
fn main() {
|
|
struct Test {
|
|
field: u32,
|
|
}
|
|
|
|
#[clippy::author]
|
|
Test {
|
|
field: if true { 1 } else { 0 },
|
|
};
|
|
|
|
let test = Test { field: 1 };
|
|
|
|
match test {
|
|
#[clippy::author]
|
|
Test { field: 1 } => {},
|
|
_ => {},
|
|
}
|
|
|
|
struct TestTuple(u32);
|
|
|
|
let test_tuple = TestTuple(1);
|
|
|
|
match test_tuple {
|
|
#[clippy::author]
|
|
TestTuple(1) => {},
|
|
_ => {},
|
|
}
|
|
|
|
struct TestMethodCall(u32);
|
|
|
|
impl TestMethodCall {
|
|
fn test(&self) {}
|
|
}
|
|
|
|
let test_method_call = TestMethodCall(1);
|
|
|
|
#[clippy::author]
|
|
test_method_call.test();
|
|
}
|