Add MatchKind member to the Match expr for pretty printing & fmt
This commit is contained in:
parent
68a58f255a
commit
78b3bf98c3
17 changed files with 76 additions and 33 deletions
|
@ -1,6 +1,6 @@
|
|||
use crate::pp::Breaks::Inconsistent;
|
||||
use crate::pprust::state::{AnnNode, PrintState, State, INDENT_UNIT};
|
||||
use ast::ForLoopKind;
|
||||
use ast::{ForLoopKind, MatchKind};
|
||||
use itertools::{Itertools, Position};
|
||||
use rustc_ast::ptr::P;
|
||||
use rustc_ast::token;
|
||||
|
@ -589,12 +589,22 @@ impl<'a> State<'a> {
|
|||
self.word_nbsp("loop");
|
||||
self.print_block_with_attrs(blk, attrs);
|
||||
}
|
||||
ast::ExprKind::Match(expr, arms) => {
|
||||
ast::ExprKind::Match(expr, arms, match_kind) => {
|
||||
self.cbox(0);
|
||||
self.ibox(0);
|
||||
self.word_nbsp("match");
|
||||
self.print_expr_as_cond(expr);
|
||||
self.space();
|
||||
|
||||
match match_kind {
|
||||
MatchKind::Prefix => {
|
||||
self.word_nbsp("match");
|
||||
self.print_expr_as_cond(expr);
|
||||
self.space();
|
||||
}
|
||||
MatchKind::Postfix => {
|
||||
self.print_expr_as_cond(expr);
|
||||
self.word_nbsp(".match");
|
||||
}
|
||||
}
|
||||
|
||||
self.bopen();
|
||||
self.print_inner_attributes_no_trailing_hardbreak(attrs);
|
||||
for arm in arms {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue