Fn is assumed when reference is passed as Pattern · Issue #79359 · rust-lang/rust (original) (raw)
Sorry, I don't exactly understand why this happened, so I can't provide much more detail.
error[E0277]: expected a `std::ops::Fn<(char,)>` closure, found `char`
--> hglfgp_glsl/src/lib.rs:21:42
|
21 | s.chars().filter(|c| !(" \n\t".contains(c))).collect::<String>()
| ^ expected an `Fn<(char,)>` closure, found `char`
The correct solution to fix this was to change |c|
to |&c|
, however the error message did not indicate what was wrong at all.
Please inform me if I need to change the format of this issue.