]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Clean up monadic operations on expected<>
authorjjasmine <tanghocle456@gmail.com>
Wed, 26 Jun 2024 14:39:00 +0000 (07:39 -0700)
committerCohenArthur <arthur.cohen@embecosm.com>
Fri, 28 Jun 2024 09:59:34 +0000 (09:59 +0000)
gcc/rust/ChangeLog:

* expand/rust-macro-builtins-asm.cc (parse_asm):
Clean up monadic operations on expected<>

Signed-off-by: badumbatish <tanghocle456@gmail.com>
gcc/rust/expand/rust-macro-builtins-asm.cc

index 9c2e8bb04197a2b73a033ba1b21de8fb739fefc9..d6cc317d7060d0cebe5ebfea5a3e86f30017f6d1 100644 (file)
@@ -740,11 +740,9 @@ parse_asm (location_t invoc_locus, AST::MacroInvocData &invoc,
                             is_global_asm == AST::AsmKind::Global);
   auto inline_asm_ctx = InlineAsmContext (inline_asm, parser, last_token_id);
 
-  tl::expected<InlineAsmContext, InlineAsmParseError> resulting_context
-    = tl::expected<InlineAsmContext, InlineAsmParseError> (inline_asm_ctx);
-  resulting_context.and_then (parse_format_strings)
-    .and_then (parse_asm_arg)
-    .and_then (validate);
+  auto resulting_context = parse_format_strings (inline_asm_ctx)
+                            .and_then (parse_asm_arg)
+                            .and_then (validate);
 
   // TODO: I'm putting the validation here because the rust reference put it
   // here Per Arthur's advice we would actually do the validation in a different