RS.CLIPPY.MATCH_SAME_ARMS

`match` with identical arm bodies

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: match_same_arms. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for match with identical arm bodies.

Note: Does not lint on wildcards if the non_exhaustive_omitted_patterns_lint feature is enabled and disallowed.

Why is this bad?

This is probably a copy & paste error. If arm bodies are the same on purpose, you can factor them using |.

Example

match foo {
    Bar => bar(),
    Quz => quz(),
    Baz => bar(), // <= oops
}

This should probably be

match foo {
    Bar => bar(),
    Quz => quz(),
    Baz => baz(), // <= fixed
}

or if the original code was not a typo:

match foo {
    Bar | Baz => bar(), // <= shows the intent better
    Quz => quz(),
}