Skip to content

Commit 73fde17

Browse files
committed
refactor the if if
1 parent d3858f7 commit 73fde17

File tree

1 file changed

+7
-3
lines changed
  • compiler/rustc_builtin_macros/src

1 file changed

+7
-3
lines changed

compiler/rustc_builtin_macros/src/asm.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,14 @@ fn parse_options<'a>(
365365

366366
'blk: {
367367
for (symbol, option) in OPTIONS {
368-
let expect =
369-
!is_global_asm || ast::InlineAsmOptions::GLOBAL_OPTIONS.contains(option);
368+
let kw_matched =
369+
if !is_global_asm || ast::InlineAsmOptions::GLOBAL_OPTIONS.contains(option) {
370+
p.eat_keyword(symbol)
371+
} else {
372+
p.eat_keyword_noexpect(symbol)
373+
};
370374

371-
if if expect { p.eat_keyword(symbol) } else { p.eat_keyword_noexpect(symbol) } {
375+
if kw_matched {
372376
try_set_option(p, args, is_global_asm, symbol, option);
373377
break 'blk;
374378
}

0 commit comments

Comments
 (0)