]> git.lizzy.rs Git - rust.git/commitdiff
Use correct width
authorSeiichi Uchida <seuchida@gmail.com>
Sun, 14 Oct 2018 12:44:56 +0000 (21:44 +0900)
committerSeiichi Uchida <seuchida@gmail.com>
Sun, 14 Oct 2018 12:47:55 +0000 (21:47 +0900)
When rewriting trait bounds on the next line, we do not want to add an extra
indentation. However, the max width should be smaller.

src/expr.rs

index 7a6a147306011c05336009bd8c60003a828a0f44..8a5b3de7a147756f066b2577cf9c38e076630392 100644 (file)
@@ -1937,7 +1937,9 @@ fn shape_from_rhs_tactic(
     rhs_tactic: RhsTactics,
 ) -> Option<Shape> {
     match rhs_tactic {
-        RhsTactics::ForceNextLineWithoutIndent => Some(shape.with_max_width(context.config)),
+        RhsTactics::ForceNextLineWithoutIndent => shape
+            .with_max_width(context.config)
+            .sub_width(shape.indent.width()),
         RhsTactics::Default => {
             Shape::indented(shape.indent.block_indent(context.config), context.config)
                 .sub_width(shape.rhs_overhead(context.config))