-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
108 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,130 @@ | ||
error: passing a unit value to a function | ||
--> $DIR/unit_arg.rs:24:9 | ||
--> $DIR/unit_arg.rs:24:5 | ||
| | ||
LL | foo({}); | ||
| ^^ | ||
| ^^^^^^^ | ||
| | ||
= note: `-D clippy::unit-arg` implied by `-D warnings` | ||
help: if you intended to pass a unit value, use a unit literal instead | ||
help: move the expressions in front of the call... | ||
| | ||
LL | {}; foo({}); | ||
| ^^^ | ||
help: ...and use unit literals instead | ||
| | ||
LL | foo(()); | ||
| ^^ | ||
|
||
error: passing a unit value to a function | ||
--> $DIR/unit_arg.rs:25:9 | ||
--> $DIR/unit_arg.rs:25:5 | ||
| | ||
LL | foo({ | ||
| _________^ | ||
LL | / foo({ | ||
LL | | 1; | ||
LL | | }); | ||
| |_____^ | ||
help: if you intended to pass a unit value, use a unit literal instead | ||
| |______^ | ||
help: move the expressions in front of the call... | ||
| | ||
LL | { | ||
LL | 1; | ||
LL | }; foo({ | ||
| | ||
help: ...and use unit literals instead | ||
| | ||
LL | foo(()); | ||
| ^^ | ||
|
||
error: passing a unit value to a function | ||
--> $DIR/unit_arg.rs:28:9 | ||
--> $DIR/unit_arg.rs:28:5 | ||
| | ||
LL | foo(foo(1)); | ||
| ^^^^^^ | ||
help: if you intended to pass a unit value, use a unit literal instead | ||
| ^^^^^^^^^^^ | ||
help: move the expressions in front of the call... | ||
| | ||
LL | foo(1); foo(foo(1)); | ||
| ^^^^^^^ | ||
help: ...and use unit literals instead | ||
| | ||
LL | foo(()); | ||
| ^^ | ||
|
||
error: passing a unit value to a function | ||
--> $DIR/unit_arg.rs:29:9 | ||
--> $DIR/unit_arg.rs:29:5 | ||
| | ||
LL | foo({ | ||
| _________^ | ||
LL | / foo({ | ||
LL | | foo(1); | ||
LL | | foo(2); | ||
LL | | }); | ||
| |_____^ | ||
help: if you intended to pass a unit value, use a unit literal instead | ||
| |______^ | ||
help: move the expressions in front of the call... | ||
| | ||
LL | { | ||
LL | foo(1); | ||
LL | foo(2); | ||
LL | }; foo({ | ||
| | ||
help: ...and use unit literals instead | ||
| | ||
LL | foo(()); | ||
| ^^ | ||
|
||
error: passing a unit value to a function | ||
--> $DIR/unit_arg.rs:33:10 | ||
--> $DIR/unit_arg.rs:33:5 | ||
| | ||
LL | foo3({}, 2, 2); | ||
| ^^ | ||
help: if you intended to pass a unit value, use a unit literal instead | ||
| ^^^^^^^^^^^^^^ | ||
help: move the expressions in front of the call... | ||
| | ||
LL | {}; foo3({}, 2, 2); | ||
| ^^^ | ||
help: ...and use unit literals instead | ||
| | ||
LL | foo3((), 2, 2); | ||
| ^^ | ||
|
||
error: passing a unit value to a function | ||
--> $DIR/unit_arg.rs:35:11 | ||
--> $DIR/unit_arg.rs:35:5 | ||
| | ||
LL | b.bar({ | ||
| ___________^ | ||
LL | / b.bar({ | ||
LL | | 1; | ||
LL | | }); | ||
| |_____^ | ||
help: if you intended to pass a unit value, use a unit literal instead | ||
| |______^ | ||
help: move the expressions in front of the call... | ||
| | ||
LL | { | ||
LL | 1; | ||
LL | }; b.bar({ | ||
| | ||
help: ...and use unit literals instead | ||
| | ||
LL | b.bar(()); | ||
| ^^ | ||
|
||
error: aborting due to 6 previous errors | ||
error: passing a unit value to a function | ||
--> $DIR/unit_arg.rs:38:5 | ||
| | ||
LL | taking_multiple_units(foo(0), foo(1)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
help: move the expressions in front of the call... | ||
| | ||
LL | foo(0); foo(1); taking_multiple_units(foo(0), foo(1)); | ||
| ^^^^^^^^^^^^^^^ | ||
help: ...and use unit literals instead | ||
| | ||
LL | taking_multiple_units((), ()); | ||
| ^^ ^^ | ||
|
||
error: passing a unit value to a function | ||
--> $DIR/unit_arg.rs:70:5 | ||
| | ||
LL | Some(foo(1)) | ||
| ^^^^^^^^^^^^ | ||
help: move the expressions in front of the call... | ||
| | ||
LL | foo(1); Some(foo(1)) | ||
| ^^^^^^^ | ||
help: ...and use unit literals instead | ||
| | ||
LL | Some(()) | ||
| ^^ | ||
|
||
error: aborting due to 8 previous errors | ||
|