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_same_arms: false negative #4244

Closed
matthiaskrgr opened this issue Jul 1, 2019 · 0 comments · Fixed by #4246
Closed

match_same_arms: false negative #4244

matthiaskrgr opened this issue Jul 1, 2019 · 0 comments · Fixed by #4246
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jul 1, 2019

#![deny(clippy::match_same_arms)]

#[derive(PartialEq, PartialOrd, Eq, Ord)]
pub enum CommandInfo {
    BuiltIn { name: String, about: Option<String> },
    External { name: String, path: std::path::PathBuf },
}

impl CommandInfo {
    pub fn name(&self) -> String {
        match self {
            CommandInfo::BuiltIn { name, .. } => name.to_string(),
            CommandInfo::External { name, .. } => name.to_string(),
        }
    }
}

fn main() {}

This used to trigger back on June 3rd but no longer does in July 1st (clippy 0.0.212 (e3cb40e 2019-06-25))

Looks like a false negative to me?


EDIT(@flip1995): Playground

EDIT(matthiaskrgr): code is from cargo 0.35.0

@flip1995 flip1995 added the C-bug Category: Clippy is not doing the correct thing label Jul 1, 2019
bors added a commit that referenced this issue Jul 2, 2019
Fix `match_same_arms` false negative

Closes #4244

changelog: Fix `match_same_arms` false negative
@bors bors closed this as completed in #4246 Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants