{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/421","labels_url":"https://api.github.com/repos/rust-lang/rfcs/issues/421/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rfcs/issues/421/comments","events_url":"https://api.github.com/repos/rust-lang/rfcs/issues/421/events","html_url":"https://github.com/rust-lang/rfcs/issues/421","id":46967775,"number":421,"title":"Matching on an enum shouldn't require full scoping inside the match","user":{"login":"rust-highfive","id":7378925,"avatar_url":"https://avatars.githubusercontent.com/u/7378925?v=3","gravatar_id":"","url":"https://api.github.com/users/rust-highfive","html_url":"https://github.com/rust-highfive","followers_url":"https://api.github.com/users/rust-highfive/followers","following_url":"https://api.github.com/users/rust-highfive/following{/other_user}","gists_url":"https://api.github.com/users/rust-highfive/gists{/gist_id}","starred_url":"https://api.github.com/users/rust-highfive/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rust-highfive/subscriptions","organizations_url":"https://api.github.com/users/rust-highfive/orgs","repos_url":"https://api.github.com/users/rust-highfive/repos","events_url":"https://api.github.com/users/rust-highfive/events{/privacy}","received_events_url":"https://api.github.com/users/rust-highfive/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2014-10-27T22:27:17Z","updated_at":"2015-07-03T16:44:48Z","closed_at":null,"body":"<a href=\"https://github.com/mdinger\"><img src=\"https://avatars.githubusercontent.com/u/4156987?v=2\" align=\"left\" width=\"96\" height=\"96\" hspace=\"10\"></img></a> **Issue by [mdinger](https://github.com/mdinger)**\n_Friday Aug 22, 2014 at 18:16 GMT_\n\n_For earlier discussion, see https://github.com/rust-lang/rust/issues/16681_\n\n_This issue was labelled with:  in the Rust repository_\n\n----\n\n```rust\r\n// main.rs\r\nextern crate really;\r\n\r\nfn main() {\r\n    let my_enum = really::long::A;\r\n\r\n    // This match works with full scoping\r\n    match my_enum {\r\n        really::long::A => {},\r\n        really::long::B => {},\r\n        really::long::C => {},\r\n        really::long::D => {},\r\n        really::long::E => {},\r\n        really::long::F => {},\r\n        really::long::G => {},\r\n    }\r\n\r\n    // This doesn't because the scope is missing but the scope\r\n    // doesn't add anything because it's matching variants of an\r\n    // already defined enum.  This should work.\r\n    match my_enum {\r\n        A => {},\r\n        B => {},\r\n        C => {},\r\n        D => {},\r\n        E => {},\r\n        F => {},\r\n        G => {},\r\n    }\r\n}\r\n```\r\n```rust\r\n// lib.rs\r\npub mod long;\r\n```\r\n\r\n```rust\r\n// long.rs\r\npub enum Enumeration {\r\n    A,\r\n    B,\r\n    C,\r\n    D,\r\n    E,\r\n    F,\r\n    G,\r\n}\r\n```\r\n\r\nI was trying to de-glob libsyntax (https://github.com/rust-lang/rust/issues/11983) but this is a real nuisance there. The enums are much much bigger than this.\r\n\r\nI hope this is clear. Let me know if it isn't.\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rfcs/issues/comments/118391118","html_url":"https://github.com/rust-lang/rfcs/issues/421#issuecomment-118391118","issue_url":"https://api.github.com/repos/rust-lang/rfcs/issues/421","id":118391118,"user":{"login":"nagisa","id":679122,"avatar_url":"https://avatars.githubusercontent.com/u/679122?v=3","gravatar_id":"","url":"https://api.github.com/users/nagisa","html_url":"https://github.com/nagisa","followers_url":"https://api.github.com/users/nagisa/followers","following_url":"https://api.github.com/users/nagisa/following{/other_user}","gists_url":"https://api.github.com/users/nagisa/gists{/gist_id}","starred_url":"https://api.github.com/users/nagisa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nagisa/subscriptions","organizations_url":"https://api.github.com/users/nagisa/orgs","repos_url":"https://api.github.com/users/nagisa/repos","events_url":"https://api.github.com/users/nagisa/events{/privacy}","received_events_url":"https://api.github.com/users/nagisa/received_events","type":"User","site_admin":false},"created_at":"2015-07-03T16:44:48Z","updated_at":"2015-07-03T16:44:48Z","body":"I’m somewhat againt, because for uncomfortably big matches/enum pathes you can use something resembling following:\r\n\r\n```\r\n    { use really::long::*;\r\n    match my_enum {\r\n        A => {},\r\n        B => {},\r\n        C => {},\r\n        D => {},\r\n        E => {},\r\n        F => {},\r\n        G => {},\r\n    }\r\n    }\r\n```\r\n\r\nYou don’t have to import these at the top level, function or block-level import is fine. Also library/module may export unqualified enum variants as well.\r\n\r\nAlso original motivation does not apply as much anymore either, because glob imports are stable."}}