Open
Description
Code
fn test() {
takes_two_args(|s| {
s.to_string();
});
}
fn takes_two_args(thing: u32, f: impl Fn(&str)) {
todo!();
}
Current output
error[E0282]: type annotations needed
--> src/lib.rs:3:21
|
3 | takes_two_args(|s| {
| ^
4 | s.to_string();
| - type must be known at this point
|
help: consider giving this closure parameter an explicit type
|
3 | takes_two_args(|s: /* Type */| {
| ++++++++++++
Desired output
Wrong number of arguments.
Rationale and extra context
In addition to wrong number of arguments, maybe we could also detect when the argument type is not a function. (Both are true in this example)
Other cases
Rust Version
1.87.0
Anything else?
No response