diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2023-06-28 13:12:07 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 18:49:33 +0100 |
commit | af07e6032f651d406c04255be68be2f9d1af0811 (patch) | |
tree | 864df18e759a07fb6df59c1cf418cdb3de420eaa | |
parent | 1083826a89e22c736a80ed93ba9c10c426cff59d (diff) | |
download | gcc-af07e6032f651d406c04255be68be2f9d1af0811.zip gcc-af07e6032f651d406c04255be68be2f9d1af0811.tar.gz gcc-af07e6032f651d406c04255be68be2f9d1af0811.tar.bz2 |
gccrs: collector: Change match arm format
Match arm were not readable with previous format options.
gcc/rust/ChangeLog:
* ast/rust-ast-collector.cc (TokenCollector::visit): Change
formatting.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
-rw-r--r-- | gcc/rust/ast/rust-ast-collector.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index 8fc0f3d..aad948e 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -1481,10 +1481,13 @@ TokenCollector::visit (MatchArm &arm) void TokenCollector::visit (MatchCase &match_case) { + indentation (); visit (match_case.get_arm ()); push (Rust::Token::make (MATCH_ARROW, Location ())); visit (match_case.get_expr ()); + indentation (); push (Rust::Token::make (COMMA, Location ())); + newline (); } void @@ -1493,11 +1496,15 @@ TokenCollector::visit (MatchExpr &expr) push (Rust::Token::make (MATCH_TOK, expr.get_locus ())); visit (expr.get_scrutinee_expr ()); push (Rust::Token::make (LEFT_CURLY, Location ())); + newline (); + increment_indentation (); visit_items_as_lines (expr.get_inner_attrs ()); for (auto &arm : expr.get_match_cases ()) { visit (arm); } + decrement_indentation (); + indentation (); push (Rust::Token::make (RIGHT_CURLY, Location ())); } |