{"action":"opened","issue":{"url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/971","repository_url":"https://api.github.com/repos/Manishearth/rust-clippy","labels_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/971/labels{/name}","comments_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/971/comments","events_url":"https://api.github.com/repos/Manishearth/rust-clippy/issues/971/events","html_url":"https://github.com/Manishearth/rust-clippy/issues/971","id":157759221,"number":971,"title":"Lint for missing pair in match on pairs of enum","user":{"login":"mcarton","id":3751788,"avatar_url":"https://avatars.githubusercontent.com/u/3751788?v=3","gravatar_id":"","url":"https://api.github.com/users/mcarton","html_url":"https://github.com/mcarton","followers_url":"https://api.github.com/users/mcarton/followers","following_url":"https://api.github.com/users/mcarton/following{/other_user}","gists_url":"https://api.github.com/users/mcarton/gists{/gist_id}","starred_url":"https://api.github.com/users/mcarton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcarton/subscriptions","organizations_url":"https://api.github.com/users/mcarton/orgs","repos_url":"https://api.github.com/users/mcarton/repos","events_url":"https://api.github.com/users/mcarton/events{/privacy}","received_events_url":"https://api.github.com/users/mcarton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-31T20:11:23Z","updated_at":"2016-05-31T20:11:23Z","closed_at":null,"body":"[This `match`](https://github.com/Manishearth/rust-clippy/blob/a892a96eeb6bb0b485dc3d4a436612a77ead5c40/clippy_lints/src/utils/hir.rs#L143-L165):\r\n```rust\r\nmatch (&left.node, &right.node) {\r\n    (&PatKind::Box(..), &PatKind::Box(..)) => …,\r\n    (&PatKind::TupleStruct(..), &PatKind::TupleStruct(..)) => …,\r\n    (&PatKind::Ident(..), &PatKind::Ident(..)) => …,\r\n    (&PatKind::Lit(..), &PatKind::Lit(ref r)) => …,\r\n    (&PatKind::QPath(..), &PatKind::QPath(..)) => …\r\n    (&PatKind::Tuple(..), &PatKind::Tuple(..)) => …\r\n    (&PatKind::Range(..), &PatKind::Range(..)) => …,\r\n    (&PatKind::Ref(..), &PatKind::Ref(..)) => …,\r\n    (&PatKind::Vec(..), &PatKind::Vec(..)) => …,\r\n    (&PatKind::Wild, &PatKind::Wild) => …,\r\n    _ => …,\r\n}\r\n```\r\n\r\nlooks 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 :cry:.\r\n\r\nWhat do you think of a lint that would warn on such `match`es that users would explicitly mark?\r\n\r\n```rust\r\n#[deny(missing_tuple)] // ¹\r\nmatch (&left.node, &right.node) {\r\n    (&PatKind::Box(..), &PatKind::Box(..)) => …,\r\n    [… same as above…],\r\n    (&PatKind::Wild, &PatKind::Wild) => …,\r\n    _ => …, // error: the tuple `(Path, Path)` is missing\r\n}\r\n```\r\n\r\n---\r\n\r\n1: alternatively we could use a `#[clippy_missing_tuple]` attribute on the `match` if `#[allow/deny/warn]` do not work on expressions."}}
{"actor":{"display_login":"mcarton"}}