Open
Description
match (&left.node, &right.node) {
(&PatKind::Box(..), &PatKind::Box(..)) => …,
(&PatKind::TupleStruct(..), &PatKind::TupleStruct(..)) => …,
(&PatKind::Ident(..), &PatKind::Ident(..)) => …,
(&PatKind::Lit(..), &PatKind::Lit(ref r)) => …,
(&PatKind::QPath(..), &PatKind::QPath(..)) => …
(&PatKind::Tuple(..), &PatKind::Tuple(..)) => …
(&PatKind::Range(..), &PatKind::Range(..)) => …,
(&PatKind::Ref(..), &PatKind::Ref(..)) => …,
(&PatKind::Vec(..), &PatKind::Vec(..)) => …,
(&PatKind::Wild, &PatKind::Wild) => …,
_ => …,
}
looks like is missing some pair (&Path(..), &Path(..))
that was not added in a previous rustup. Of course in such case it would not be reasonable to list the n×(n-1)
missing cases and we used _
, but that means Rust won’t tell us about that missing pair 😢.
What do you think of a lint that would warn on such match
es that users would explicitly mark?
#[deny(missing_tuple)] // ¹
match (&left.node, &right.node) {
(&PatKind::Box(..), &PatKind::Box(..)) => …,
[… same as above…],
(&PatKind::Wild, &PatKind::Wild) => …,
_ => …, // error: the tuple `(Path, Path)` is missing
}
1: alternatively we could use a #[clippy_missing_tuple]
attribute on the match
if #[allow/deny/warn]
do not work on expressions.