Merge pull request #530 from marcusklaas/match-inner-block
Bump match inner block indent a level
This commit is contained in:
commit
efa5df39a5
@ -863,7 +863,7 @@ impl Rewrite for ast::Arm {
|
||||
// If the patterns were previously stacked, keep them stacked.
|
||||
let pat_span = mk_sp(pats[0].span.lo, pats[pats.len() - 1].span.hi);
|
||||
let pat_str = context.snippet(pat_span);
|
||||
vertical = pat_str.find('\n').is_some();
|
||||
vertical = pat_str.contains('\n');
|
||||
}
|
||||
|
||||
let pats_width = if vertical {
|
||||
@ -922,10 +922,9 @@ impl Rewrite for ast::Arm {
|
||||
}
|
||||
|
||||
let body_budget = try_opt!(width.checked_sub(context.config.tab_spaces));
|
||||
let next_line_body = nop_block_collapse(body.rewrite(context,
|
||||
body_budget,
|
||||
context.block_indent
|
||||
.block_indent(context.config)),
|
||||
let indent = context.block_indent.block_indent(context.config);
|
||||
let inner_context = &RewriteContext { block_indent: indent, ..*context };
|
||||
let next_line_body = nop_block_collapse(body.rewrite(inner_context, body_budget, indent),
|
||||
body_budget);
|
||||
|
||||
let body_str = try_opt!(match_arm_heuristic(same_line_body.as_ref().map(|x| &x[..]),
|
||||
|
@ -243,3 +243,23 @@ fn issue508() {
|
||||
Some(NodeTypeId::Element(_)) => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn issue496() {{{{
|
||||
match def {
|
||||
def::DefConst(def_id) | def::DefAssociatedConst(def_id) =>
|
||||
match const_eval::lookup_const_by_id(cx.tcx, def_id, Some(self.pat.id)) {
|
||||
Some(const_expr) => { x }}}}}}}
|
||||
|
||||
fn issue494() {
|
||||
{
|
||||
match stmt.node {
|
||||
hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) =>
|
||||
result.push(
|
||||
StmtRef::Mirror(
|
||||
Box::new(Stmt { span: stmt.span,
|
||||
kind: StmtKind::Expr {
|
||||
scope: cx.tcx.region_maps.node_extent(id),
|
||||
expr: expr.to_ref() } }))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -247,3 +247,35 @@ fn issue508() {
|
||||
Some(NodeTypeId::Element(_)) => false,
|
||||
}
|
||||
}
|
||||
|
||||
fn issue496() {
|
||||
{
|
||||
{
|
||||
{
|
||||
match def {
|
||||
def::DefConst(def_id) | def::DefAssociatedConst(def_id) =>
|
||||
match const_eval::lookup_const_by_id(cx.tcx, def_id, Some(self.pat.id)) {
|
||||
Some(const_expr) => {
|
||||
x
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn issue494() {
|
||||
{
|
||||
match stmt.node {
|
||||
hir::StmtExpr(ref expr, id) | hir::StmtSemi(ref expr, id) =>
|
||||
result.push(StmtRef::Mirror(Box::new(Stmt {
|
||||
span: stmt.span,
|
||||
kind: StmtKind::Expr {
|
||||
scope: cx.tcx.region_maps.node_extent(id),
|
||||
expr: expr.to_ref(),
|
||||
},
|
||||
}))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user