X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Ftools%2Fclippy%2Ftests%2Fui%2Funit_arg.rs;h=2992abae775b8ffb438f5ae4e645899698a1302e;hb=d139a720a2c0ad7066c43edad6ec6c2aa9613740;hp=d90c49f79de623de06b623664d540e3f2498d4d0;hpb=8cb8d9cfe26d9044efca0343067857229fd90b97;p=rust.git diff --git a/src/tools/clippy/tests/ui/unit_arg.rs b/src/tools/clippy/tests/ui/unit_arg.rs index d90c49f79de..2992abae775 100644 --- a/src/tools/clippy/tests/ui/unit_arg.rs +++ b/src/tools/clippy/tests/ui/unit_arg.rs @@ -1,6 +1,5 @@ -// run-rustfix #![warn(clippy::unit_arg)] -#![allow(unused_braces, clippy::no_effect, unused_must_use)] +#![allow(clippy::no_effect, unused_must_use, unused_variables)] use std::fmt::Debug; @@ -21,7 +20,6 @@ fn bar(&self, t: T) { } fn bad() { - foo({}); foo({ 1; }); @@ -30,11 +28,25 @@ fn bad() { foo(1); foo(2); }); - foo3({}, 2, 2); let b = Bar; b.bar({ 1; }); + taking_multiple_units(foo(0), foo(1)); + taking_multiple_units(foo(0), { + foo(1); + foo(2); + }); + taking_multiple_units( + { + foo(0); + foo(1); + }, + { + foo(2); + foo(3); + }, + ); } fn ok() { @@ -65,6 +77,13 @@ fn fallible() -> Result<(), i32> { } } +#[allow(dead_code)] +fn returning_expr() -> Option<()> { + Some(foo(1)) +} + +fn taking_multiple_units(a: (), b: ()) {} + fn main() { bad(); ok();