]> git.lizzy.rs Git - rust.git/blobdiff - src/missed_spans.rs
Use the last line's width for indent width in rewriting missed span
[rust.git] / src / missed_spans.rs
index 301e1583029c8d3ef4b28e86bcba7e138c3b2688..5e350cf41b40b05e6186f564ad3c04ffe47b7f63 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use Shape;
+use {Indent, Shape};
 use comment::{rewrite_comment, CodeCharKind, CommentCodeSlices};
 use config::WriteMode;
 use syntax::codemap::{BytePos, Pos, Span};
@@ -169,11 +169,12 @@ fn replace_chars(string: &str) -> String {
                         self.config.comment_width(),
                         self.config.max_width() - self.block_indent.width(),
                     );
+                    let comment_indent = Indent::from_width(self.config, self.buffer.cur_offset());
 
                     self.buffer.push_str(&rewrite_comment(
                         subslice,
                         false,
-                        Shape::legacy(comment_width, self.block_indent),
+                        Shape::legacy(comment_width, comment_indent),
                         self.config,
                     ).unwrap());