refactor the if if

This commit is contained in:
Folkert 2024-07-26 00:08:22 +02:00
parent d3858f7465
commit 73fde17017
No known key found for this signature in database
GPG Key ID: 1F17F6FFD112B97C

View File

@ -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;
}