Skip to content

Identical match arm not detected #11223

Closed
@vanillajonathan

Description

@vanillajonathan

Summary

Clippy doesn't catch that match arms are identical when using if on Some.

Lint Name

match_same_arms

Reproducer

I tried this code:

match Some(3) {
    Some(v) if v == 3 => true,
    Some(v) if v == 3 => true,
    _ => false,

I expected to see this happen: Clippy would catch that the arms are identical.

Instead, this happened: Nothing. Clippy didn't catch on.

Version

rustc 1.71.0 (8ede3aae2 2023-07-12)
binary: rustc
commit-hash: 8ede3aae28fe6e4d52b38157d7bfe0d3bceef225
commit-date: 2023-07-12
host: x86_64-unknown-linux-gnu
release: 1.71.0
LLVM version: 16.0.5

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn'tgood 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