Auto merge of #59035 - estebank:closure-instacall, r=davidtwco

When encountering `||{}()`, suggest the likely intended `(||{})()`

Fix #55851.
This commit is contained in:
bors 2019-03-22 11:18:11 +00:00
commit 2210e9a6a9
3 changed files with 53 additions and 1 deletions

View file

@ -0,0 +1,4 @@
fn main() {
let _ = ||{}();
//~^ ERROR expected function, found `()`
}

View file

@ -0,0 +1,15 @@
error[E0618]: expected function, found `()`
--> $DIR/suggest-on-bare-closure-call.rs:2:15
|
LL | let _ = ||{}();
| ^^--
| |
| call expression requires function
help: if you meant to create this closure and immediately call it, surround the closure with parenthesis
|
LL | let _ = (||{})();
| ^ ^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0618`.