diff options
Diffstat (limited to 'src/tools/clippy/tests/ui/unit_arg_empty_blocks.fixed')
-rw-r--r-- | src/tools/clippy/tests/ui/unit_arg_empty_blocks.fixed | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/unit_arg_empty_blocks.fixed b/src/tools/clippy/tests/ui/unit_arg_empty_blocks.fixed new file mode 100644 index 000000000..9400e93ca --- /dev/null +++ b/src/tools/clippy/tests/ui/unit_arg_empty_blocks.fixed @@ -0,0 +1,30 @@ +// run-rustfix +#![warn(clippy::unit_arg)] +#![allow(clippy::no_effect, unused_must_use, unused_variables)] + +use std::fmt::Debug; + +fn foo<T: Debug>(t: T) { + println!("{:?}", t); +} + +fn foo3<T1: Debug, T2: Debug, T3: Debug>(t1: T1, t2: T2, t3: T3) { + println!("{:?}, {:?}, {:?}", t1, t2, t3); +} + +fn bad() { + foo(()); + foo3((), 2, 2); + foo(0); + taking_two_units((), ()); + foo(0); + foo(1); + taking_three_units((), (), ()); +} + +fn taking_two_units(a: (), b: ()) {} +fn taking_three_units(a: (), b: (), c: ()) {} + +fn main() { + bad(); +} |