don't unnecessarily walk more in visitor and add more tests

This commit is contained in:
y21 2023-06-15 22:04:25 +02:00
parent e305b0730f
commit 3fe2478ecf
4 changed files with 30 additions and 4 deletions

View file

@ -78,4 +78,11 @@ fn issue9956() {
|| || || 42
}
let _ = x()()()();
fn bar() -> fn(i32, i32) {
foo
}
fn foo(_: i32, _: i32) {}
bar()(42, 5);
foo(42, 5);
}

View file

@ -78,4 +78,11 @@ fn issue9956() {
|| || || 42
}
let _ = x()()()();
fn bar() -> fn(i32, i32) {
foo
}
fn foo(_: i32, _: i32) {}
bar()((|| || 42)()(), 5);
foo((|| || 42)()(), 5);
}

View file

@ -110,5 +110,17 @@ error: try not to call a closure in the expression where it is declared
LL | let a = (|| echo!((|| 123)))()();
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try doing something like: `123`
error: aborting due to 12 previous errors
error: try not to call a closure in the expression where it is declared
--> $DIR/redundant_closure_call_fixable.rs:86:11
|
LL | bar()((|| || 42)()(), 5);
| ^^^^^^^^^^^^^^ help: try doing something like: `42`
error: try not to call a closure in the expression where it is declared
--> $DIR/redundant_closure_call_fixable.rs:87:9
|
LL | foo((|| || 42)()(), 5);
| ^^^^^^^^^^^^^^ help: try doing something like: `42`
error: aborting due to 14 previous errors