Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

match_like_matches_macro: strip refs in suggestion #6503

Closed
matthiaskrgr opened this issue Dec 24, 2020 · 0 comments · Fixed by #6532
Closed

match_like_matches_macro: strip refs in suggestion #6503

matthiaskrgr opened this issue Dec 24, 2020 · 0 comments · Fixed by #6532
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@matthiaskrgr
Copy link
Member

fn main() {
    let x = Some(3);

    // original:
    let z = match &x {
        Some(3) => true,
        _ => false,
    };

    // current suggestion
    let y = matches!(&x, Some(3));
    // could be simplified to:
    let y = matches!(x, Some(3));
}

Suggested by @LingMan :)

@matthiaskrgr matthiaskrgr added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Dec 24, 2020
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jan 1, 2021
fixes rust-lang#6503

changelog: match_like_matches_macro: strip refs in suggestion (rust-lang#6503)
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jan 3, 2021
fixes rust-lang#6503

changelog: match_like_matches_macro: strip refs in suggestion (rust-lang#6503)
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jan 3, 2021
fixes rust-lang#6503

changelog: match_like_matches_macro: strip refs in suggestion (rust-lang#6503)
matthiaskrgr added a commit to matthiaskrgr/rust-clippy that referenced this issue Jan 3, 2021
fixes rust-lang#6503

changelog: match_like_matches_macro: strip refs in suggestion (rust-lang#6503)
bors added a commit that referenced this issue Jan 21, 2021
match_like_matches_macro: strip refs in suggestion

fixes #6503

changelog: match_like_matches_macro: strip refs in suggestion (#6503)
@bors bors closed this as completed in 39f39d5 Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant