"wrap the u32
in a closure with no arguments" doesn't always make sense
#124074
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
The suggestion to "wrap" should not be shown, as there is no argument.
Rationale and extra context
"wrap the
u32
in a closure with no arguments:|| { /* code */ }
" doesn't make sense as there is no code of that type.Other cases
No response
Rust Version
Anything else?
Even if there is an argument, this is somewhat questionable:
This suggests
f(|| 0u32)
but that's still ill-typed as the closure must have return value()
. So the suggestion should probably only be shown if the type of the expression matches the return type of the closure.The text was updated successfully, but these errors were encountered: