diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/tools/clippy/tests/ui/unit_arg.stderr | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/tools/clippy/tests/ui/unit_arg.stderr')
-rw-r--r-- | src/tools/clippy/tests/ui/unit_arg.stderr | 187 |
1 files changed, 187 insertions, 0 deletions
diff --git a/src/tools/clippy/tests/ui/unit_arg.stderr b/src/tools/clippy/tests/ui/unit_arg.stderr new file mode 100644 index 000000000..11cfe66a3 --- /dev/null +++ b/src/tools/clippy/tests/ui/unit_arg.stderr @@ -0,0 +1,187 @@ +error: passing a unit value to a function + --> $DIR/unit_arg.rs:57:5 + | +LL | / foo({ +LL | | 1; +LL | | }); + | |______^ + | + = note: `-D clippy::unit-arg` implied by `-D warnings` +help: remove the semicolon from the last statement in the block + | +LL | 1 + | +help: or move the expression in front of the call and replace it with the unit literal `()` + | +LL ~ { +LL + 1; +LL + }; +LL ~ foo(()); + | + +error: passing a unit value to a function + --> $DIR/unit_arg.rs:60:5 + | +LL | foo(foo(1)); + | ^^^^^^^^^^^ + | +help: move the expression in front of the call and replace it with the unit literal `()` + | +LL ~ foo(1); +LL ~ foo(()); + | + +error: passing a unit value to a function + --> $DIR/unit_arg.rs:61:5 + | +LL | / foo({ +LL | | foo(1); +LL | | foo(2); +LL | | }); + | |______^ + | +help: remove the semicolon from the last statement in the block + | +LL | foo(2) + | +help: or move the expression in front of the call and replace it with the unit literal `()` + | +LL ~ { +LL + foo(1); +LL + foo(2); +LL + }; +LL ~ foo(()); + | + +error: passing a unit value to a function + --> $DIR/unit_arg.rs:66:5 + | +LL | / b.bar({ +LL | | 1; +LL | | }); + | |______^ + | +help: remove the semicolon from the last statement in the block + | +LL | 1 + | +help: or move the expression in front of the call and replace it with the unit literal `()` + | +LL ~ { +LL + 1; +LL + }; +LL ~ b.bar(()); + | + +error: passing unit values to a function + --> $DIR/unit_arg.rs:69:5 + | +LL | taking_multiple_units(foo(0), foo(1)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +help: move the expressions in front of the call and replace them with the unit literal `()` + | +LL ~ foo(0); +LL + foo(1); +LL ~ taking_multiple_units((), ()); + | + +error: passing unit values to a function + --> $DIR/unit_arg.rs:70:5 + | +LL | / taking_multiple_units(foo(0), { +LL | | foo(1); +LL | | foo(2); +LL | | }); + | |______^ + | +help: remove the semicolon from the last statement in the block + | +LL | foo(2) + | +help: or move the expressions in front of the call and replace them with the unit literal `()` + | +LL ~ foo(0); +LL + { +LL + foo(1); +LL + foo(2); +LL + }; +LL ~ taking_multiple_units((), ()); + | + +error: passing unit values to a function + --> $DIR/unit_arg.rs:74:5 + | +LL | / taking_multiple_units( +LL | | { +LL | | foo(0); +LL | | foo(1); +... | +LL | | }, +LL | | ); + | |_____^ + | +help: remove the semicolon from the last statement in the block + | +LL | foo(1) + | +help: remove the semicolon from the last statement in the block + | +LL | foo(3) + | +help: or move the expressions in front of the call and replace them with the unit literal `()` + | +LL ~ { +LL + foo(0); +LL + foo(1); +LL + }; +LL + { +LL + foo(2); +LL + foo(3); +LL + }; +LL + taking_multiple_units( +LL + (), +LL + (), +LL ~ ); + | + +error: passing a unit value to a function + --> $DIR/unit_arg.rs:85:13 + | +LL | None.or(Some(foo(2))); + | ^^^^^^^^^^^^ + | +help: move the expression in front of the call and replace it with the unit literal `()` + | +LL ~ None.or({ +LL + foo(2); +LL + Some(()) +LL ~ }); + | + +error: passing a unit value to a function + --> $DIR/unit_arg.rs:88:5 + | +LL | foo(foo(())); + | ^^^^^^^^^^^^ + | +help: move the expression in front of the call and replace it with the unit literal `()` + | +LL ~ foo(()); +LL ~ foo(()); + | + +error: passing a unit value to a function + --> $DIR/unit_arg.rs:125:5 + | +LL | Some(foo(1)) + | ^^^^^^^^^^^^ + | +help: move the expression in front of the call and replace it with the unit literal `()` + | +LL ~ foo(1); +LL + Some(()) + | + +error: aborting due to 10 previous errors + |