Skip to content

Wrong example codes for single_match and single_match_else (-> is used instead of =>) #1232

@lo48576

Description

@lo48576

I found the doc is wrong (https://github.com/Manishearth/rust-clippy/blob/5f09020e90b485481fde984cc2e31c0112ebf1f1/clippy_lints/src/matches.rs#L25 , https://github.com/Manishearth/rust-clippy/blob/5f09020e90b485481fde984cc2e31c0112ebf1f1/clippy_lints/src/matches.rs#L46 , https://github.com/l1048576/rust-clippy/blob/a878916ad54eba5e92a3e6f0906e5099b26815d1/src/matches.rs#L23 , etc...).
The examples are as follows:

match x {
    Some(ref foo) -> bar(foo),
    _ => bar(other_ref),
}

but it is wrong because the former arms should be Some(ref foo) => bar(foo).

I tried to write pull request, but there are so many branches and I don't know which branch to fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documentationArea: Adding or improving documentationC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions