-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Suggest to take and ignore args while closure args count mismatching #52647
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
87f0c1f
27c0d56
a71deb2
9492176
40c0339
d5256b7
1d79588
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,10 @@ error[E0593]: closure is expected to take 2 arguments, but it takes 0 arguments | |
--> $DIR/closure-arg-count.rs:15:15 | ||
| | ||
LL | [1, 2, 3].sort_by(|| panic!()); | ||
| ^^^^^^^ -- takes 0 arguments | ||
| | | ||
| ^^^^^^^ -- | ||
| | | | ||
| | takes 0 arguments | ||
| | help: change the closure to take and ignore the arguments: `|_, _|` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @estebank the position of this help message is a bit weird since I
How to fix this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestions that have fewer than 10 words (among other things) are emitted as above, inline. Making the message longer is one of the ways of ensuring the separate suggestion line. |
||
| expected closure that takes 2 arguments | ||
|
||
error[E0593]: closure is expected to take 2 arguments, but it takes 1 argument | ||
|
@@ -42,8 +44,10 @@ error[E0593]: closure is expected to take 1 argument, but it takes 0 arguments | |
--> $DIR/closure-arg-count.rs:23:5 | ||
| | ||
LL | f(|| panic!()); | ||
| ^ -- takes 0 arguments | ||
| | | ||
| ^ -- | ||
| | | | ||
| | takes 0 arguments | ||
| | help: change the closure to take and ignore the argument: `|_|` | ||
| expected closure that takes 1 argument | ||
| | ||
note: required by `f` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.