mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
Add original test case from issue
This commit is contained in:
parent
9fe9d94abd
commit
cbe6eec3e6
2 changed files with 31 additions and 10 deletions
|
@ -31,6 +31,26 @@ fn baz<T: Debug>(t: T) {
|
|||
foo(t);
|
||||
}
|
||||
|
||||
trait Tr {
|
||||
type Args;
|
||||
fn do_it(args: Self::Args);
|
||||
}
|
||||
|
||||
struct A;
|
||||
impl Tr for A {
|
||||
type Args = ();
|
||||
fn do_it(_: Self::Args) {}
|
||||
}
|
||||
|
||||
struct B;
|
||||
impl Tr for B {
|
||||
type Args = <A as Tr>::Args;
|
||||
|
||||
fn do_it(args: Self::Args) {
|
||||
A::do_it(args)
|
||||
}
|
||||
}
|
||||
|
||||
fn bad() {
|
||||
foo({
|
||||
1;
|
||||
|
@ -78,6 +98,7 @@ fn ok() {
|
|||
let named_unit_arg = ();
|
||||
foo(named_unit_arg);
|
||||
baz(());
|
||||
B::do_it(());
|
||||
}
|
||||
|
||||
fn question_mark() -> Result<(), ()> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error: passing a unit value to a function
|
||||
--> $DIR/unit_arg.rs:35:5
|
||||
--> $DIR/unit_arg.rs:55:5
|
||||
|
|
||||
LL | / foo({
|
||||
LL | | 1;
|
||||
|
@ -20,7 +20,7 @@ LL | foo(());
|
|||
|
|
||||
|
||||
error: passing a unit value to a function
|
||||
--> $DIR/unit_arg.rs:38:5
|
||||
--> $DIR/unit_arg.rs:58:5
|
||||
|
|
||||
LL | foo(foo(1));
|
||||
| ^^^^^^^^^^^
|
||||
|
@ -32,7 +32,7 @@ LL | foo(());
|
|||
|
|
||||
|
||||
error: passing a unit value to a function
|
||||
--> $DIR/unit_arg.rs:39:5
|
||||
--> $DIR/unit_arg.rs:59:5
|
||||
|
|
||||
LL | / foo({
|
||||
LL | | foo(1);
|
||||
|
@ -54,7 +54,7 @@ LL | foo(());
|
|||
|
|
||||
|
||||
error: passing a unit value to a function
|
||||
--> $DIR/unit_arg.rs:44:5
|
||||
--> $DIR/unit_arg.rs:64:5
|
||||
|
|
||||
LL | / b.bar({
|
||||
LL | | 1;
|
||||
|
@ -74,7 +74,7 @@ LL | b.bar(());
|
|||
|
|
||||
|
||||
error: passing unit values to a function
|
||||
--> $DIR/unit_arg.rs:47:5
|
||||
--> $DIR/unit_arg.rs:67:5
|
||||
|
|
||||
LL | taking_multiple_units(foo(0), foo(1));
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -87,7 +87,7 @@ LL | taking_multiple_units((), ());
|
|||
|
|
||||
|
||||
error: passing unit values to a function
|
||||
--> $DIR/unit_arg.rs:48:5
|
||||
--> $DIR/unit_arg.rs:68:5
|
||||
|
|
||||
LL | / taking_multiple_units(foo(0), {
|
||||
LL | | foo(1);
|
||||
|
@ -110,7 +110,7 @@ LL | taking_multiple_units((), ());
|
|||
|
|
||||
|
||||
error: passing unit values to a function
|
||||
--> $DIR/unit_arg.rs:52:5
|
||||
--> $DIR/unit_arg.rs:72:5
|
||||
|
|
||||
LL | / taking_multiple_units(
|
||||
LL | | {
|
||||
|
@ -140,7 +140,7 @@ LL | foo(2);
|
|||
...
|
||||
|
||||
error: passing a unit value to a function
|
||||
--> $DIR/unit_arg.rs:63:13
|
||||
--> $DIR/unit_arg.rs:83:13
|
||||
|
|
||||
LL | None.or(Some(foo(2)));
|
||||
| ^^^^^^^^^^^^
|
||||
|
@ -154,7 +154,7 @@ LL | });
|
|||
|
|
||||
|
||||
error: passing a unit value to a function
|
||||
--> $DIR/unit_arg.rs:66:5
|
||||
--> $DIR/unit_arg.rs:86:5
|
||||
|
|
||||
LL | foo(foo(()));
|
||||
| ^^^^^^^^^^^^
|
||||
|
@ -166,7 +166,7 @@ LL | foo(());
|
|||
|
|
||||
|
||||
error: passing a unit value to a function
|
||||
--> $DIR/unit_arg.rs:102:5
|
||||
--> $DIR/unit_arg.rs:123:5
|
||||
|
|
||||
LL | Some(foo(1))
|
||||
| ^^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in a new issue