diff options
| author | bors <bors@rust-lang.org> | 2024-11-08 16:49:13 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-08 16:49:13 +0000 |
| commit | 59cec72a57af178767a7b8e7f624b06cc50f1087 (patch) | |
| tree | cb3a4b42830fb86ca849abdb473328e4033fe8db /src/tools/clippy/tests/ui/author/struct.rs | |
| parent | 209799f3b910c64c8bd5001c0a8a55e03e7c2614 (diff) | |
| parent | 0aafd6552b58a924d1adf6845683fd20d87289f2 (diff) | |
| download | rust-59cec72a57af178767a7b8e7f624b06cc50f1087.tar.gz rust-59cec72a57af178767a7b8e7f624b06cc50f1087.zip | |
Auto merge of #132746 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update r? `@Manishearth`
Diffstat (limited to 'src/tools/clippy/tests/ui/author/struct.rs')
| -rw-r--r-- | src/tools/clippy/tests/ui/author/struct.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/author/struct.rs b/src/tools/clippy/tests/ui/author/struct.rs new file mode 100644 index 00000000000..a99bdfc1313 --- /dev/null +++ b/src/tools/clippy/tests/ui/author/struct.rs @@ -0,0 +1,45 @@ +#![allow( + clippy::unnecessary_operation, + clippy::single_match, + clippy::no_effect, + clippy::bool_to_int_with_if +)] +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(); +} |
