X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fexpr.rs;h=674f719b5c74ba8957aece1eb818d6805fb73f29;hb=4568c1a70f64d4ab77f9fd9553d532f0bcbe0d84;hp=fef4a024cf5e306c48ab7fedbb192985baf6481a;hpb=838df8dfb60e8a17b3b3b43a642da0d8ca9828e2;p=rust.git diff --git a/src/expr.rs b/src/expr.rs index fef4a024cf5..674f719b5c7 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -1029,7 +1029,8 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option { false, true, mk_sp(else_block.span.lo(), self.span.hi()), - ).rewrite(context, shape) + ) + .rewrite(context, shape) } ast::ExprKind::If(ref cond, ref if_block, ref next_else_block) => { ControlFlow::new_if( @@ -1040,7 +1041,8 @@ fn rewrite(&self, context: &RewriteContext, shape: Shape) -> Option { false, true, mk_sp(else_block.span.lo(), self.span.hi()), - ).rewrite(context, shape) + ) + .rewrite(context, shape) } _ => { last_in_chain = true; @@ -1237,7 +1239,8 @@ fn rewrite_string_lit(context: &RewriteContext, span: Span, shape: Shape) -> Opt new_indent.to_string(context.config), line.trim_left() ) - }).collect::>() + }) + .collect::>() .join("\n") .trim_left(), ); @@ -1486,7 +1489,12 @@ fn rewrite_index( .offset_left(offset) .and_then(|shape| shape.sub_width(1 + rhs_overhead)) } else { - shape.visual_indent(offset).sub_width(offset + 1) + match context.config.indent_style() { + IndentStyle::Block => shape + .offset_left(offset) + .and_then(|shape| shape.sub_width(1)), + IndentStyle::Visual => shape.visual_indent(offset).sub_width(offset + 1), + } }; let orig_index_rw = index_shape.and_then(|s| index.rewrite(context, s));