Skip to content

Fn is assumed when reference is passed as Pattern #79359

Closed
@heav-4

Description

@heav-4

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-trait-systemArea: Trait systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.D-confusingDiagnostics: Confusing error or lint that should be reworked.D-newcomer-roadblockDiagnostics: Confusing error or lint; hard to understand for new users.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions