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

False positive with match_same_arms #2185

Closed
jDomantas opened this issue Oct 28, 2017 · 1 comment
Closed

False positive with match_same_arms #2185

jDomantas opened this issue Oct 28, 2017 · 1 comment

Comments

@jDomantas
Copy link

If two arms have same values after inlining constants, clippy will report a lint on those arms. Is this a good idea? In my code I had two constants that were semantically different but happened to have the same value, and the suggested replacement did not really make sense.

Here's an example that triggers the lint:

const FOO: u32 = 4;
const BAR: u32 = 4;

fn main() {
    match 1 {
        1 => FOO,
        2 => BAR,
        _ => 0,
    };
}
@8573
Copy link

8573 commented Jul 21, 2020

Has this been fixed in commit ff32d5f?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants