From 73fde1701762e82227cd9fe588b06ee15719d252 Mon Sep 17 00:00:00 2001 From: Folkert Date: Fri, 26 Jul 2024 00:08:22 +0200 Subject: [PATCH] refactor the `if if` --- compiler/rustc_builtin_macros/src/asm.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index 96fc40ed1eb..218529b9ed7 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -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; }