aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-06-28 13:12:07 +0200
committerCohenArthur <arthur.cohen@embecosm.com>2023-07-07 13:46:54 +0000
commitaf4407fdf643fb1b323914dac5cbff418c4e1624 (patch)
tree5716c4fd4b995a4cd51c4c51cde9e8e482cf53d7
parent23d13cbcb39b685599a34b37fe25e7a7332d34de (diff)
downloadgcc-af4407fdf643fb1b323914dac5cbff418c4e1624.zip
gcc-af4407fdf643fb1b323914dac5cbff418c4e1624.tar.gz
gcc-af4407fdf643fb1b323914dac5cbff418c4e1624.tar.bz2
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.cc7
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 ()));
}