Closed
Description
If the two arms do not have the same actual type, pulling them together with |
will fail. The lint should not trigger if the actual types of the match arms differ.
E.g.
enum Foo<'a> {
Bar(&'a FooBar),
Baz(&'a Buzz),
}
let x: &Any = match foo {
Bar(ref bar) => bar,
Baz(ref bar) => bar,
}
Changing it to
let x: &Any = match foo {
Bar(ref bar) |
Baz(ref bar) => bar,
}
will fail with a type error.
Metadata
Metadata
Assignees
Labels
Category: Clippy is not doing the correct thingCall for participation: Medium difficulty level problem and requires some initial experience.Call for participation: This issue needs a Minimal Complete and Verifiable ExampleIssue: The lint was triggered on code it shouldn't haveLint: Belongs in the correctness lint groupType: Probably requires verifiying types