Skip to content

Commit 399d5a8

Browse files
committed
Touch up syn parsing in symbols macro
1 parent ea29866 commit 399d5a8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

compiler/rustc_macros/src/symbols.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ struct Symbol {
5959
impl Parse for Symbol {
6060
fn parse(input: ParseStream<'_>) -> Result<Self> {
6161
let name = input.parse()?;
62-
let value = match input.parse::<Token![:]>() {
63-
Ok(_) => Some(input.parse()?),
64-
Err(_) => None,
65-
};
62+
let colon_token: Option<Token![:]> = input.parse()?;
63+
let value = if colon_token.is_some() { Some(input.parse()?) } else { None };
6664

6765
Ok(Symbol { name, value })
6866
}

0 commit comments

Comments
 (0)