don't unnecessarily walk more in visitor and add more tests
This commit is contained in:
parent
e305b0730f
commit
3fe2478ecf
4 changed files with 30 additions and 4 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue