diff options
| author | bors <bors@rust-lang.org> | 2017-05-16 20:42:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-05-16 20:42:52 +0000 |
| commit | 0f68728fb372ff6b0b543f87ac6776f9d12a4b05 (patch) | |
| tree | bd2b86d88d2d636da68dd07e3c654472eaa2dd1b /src/libsyntax | |
| parent | b28cf7564a1e7ed45855c2dbee744f76a191b052 (diff) | |
| parent | 9678ad2b0da8999b55786a1159280266c7ca7e64 (diff) | |
| download | rust-0f68728fb372ff6b0b543f87ac6776f9d12a4b05.tar.gz rust-0f68728fb372ff6b0b543f87ac6776f9d12a4b05.zip | |
Auto merge of #42038 - Mark-Simulacrum:rollup, r=Mark-Simulacrum
Rollup of 8 pull requests - Successful merges: #41489, #41982, #41994, #41995, #42001, #42005, #42011, #42028 - Failed merges:
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index eb0b7c29f8d..780b7ec8c2a 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -267,11 +267,12 @@ pub fn parse_failure_msg(tok: Token) -> String { /// Perform a token equality check, ignoring syntax context (that is, an unhygienic comparison) fn token_name_eq(t1 : &Token, t2 : &Token) -> bool { - match (t1,t2) { - (&token::Ident(id1),&token::Ident(id2)) - | (&token::Lifetime(id1),&token::Lifetime(id2)) => - id1.name == id2.name, - _ => *t1 == *t2 + if let (Some(id1), Some(id2)) = (t1.ident(), t2.ident()) { + id1.name == id2.name + } else if let (&token::Lifetime(id1), &token::Lifetime(id2)) = (t1, t2) { + id1.name == id2.name + } else { + *t1 == *t2 } } |
