Skip to content

Commit

Permalink
refactor the if if
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev committed Jul 25, 2024
1 parent d3858f7 commit 73fde17
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions compiler/rustc_builtin_macros/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,14 @@ fn parse_options<'a>(

'blk: {
for (symbol, option) in OPTIONS {
let expect =
!is_global_asm || ast::InlineAsmOptions::GLOBAL_OPTIONS.contains(option);
let kw_matched =
if !is_global_asm || ast::InlineAsmOptions::GLOBAL_OPTIONS.contains(option) {
p.eat_keyword(symbol)
} else {
p.eat_keyword_noexpect(symbol)
};

if if expect { p.eat_keyword(symbol) } else { p.eat_keyword_noexpect(symbol) } {
if kw_matched {
try_set_option(p, args, is_global_asm, symbol, option);
break 'blk;
}
Expand Down

0 comments on commit 73fde17

Please sign in to comment.