mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-13 20:46:48 +00:00
Use the last line's width for indent width in rewriting missed span
to fix unindented comments
This commit is contained in:
parent
2fb5affb5f
commit
97d9e6b373
@ -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 @@ impl<'a> FmtVisitor<'a> {
|
||||
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());
|
||||
|
||||
|
@ -9,7 +9,6 @@ fn test() {
|
||||
// comment
|
||||
// comment2
|
||||
|
||||
// FIXME(1275)
|
||||
code(); /* leave this comment alone!
|
||||
* ok? */
|
||||
|
||||
|
@ -5,7 +5,6 @@ fn test() {
|
||||
// comment
|
||||
// comment2
|
||||
|
||||
// FIXME(1275)
|
||||
code(); /* leave this comment alone!
|
||||
* ok? */
|
||||
|
||||
|
@ -9,9 +9,8 @@ fn test() {
|
||||
// comment
|
||||
// comment2
|
||||
|
||||
// FIXME(1275)
|
||||
code(); // leave this comment alone!
|
||||
// ok?
|
||||
// ok?
|
||||
|
||||
// Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a
|
||||
// diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam
|
||||
@ -33,7 +32,7 @@ fn test() {
|
||||
// .unwrap());
|
||||
|
||||
funk(); // dontchangeme
|
||||
// or me
|
||||
// or me
|
||||
|
||||
// #1388
|
||||
const EXCEPTION_PATHS: &'static [&'static str] = &[
|
||||
|
@ -5,9 +5,8 @@ fn test() {
|
||||
// comment
|
||||
// comment2
|
||||
|
||||
// FIXME(1275)
|
||||
code(); /* leave this comment alone!
|
||||
* ok? */
|
||||
* ok? */
|
||||
|
||||
/* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a
|
||||
* diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam
|
||||
@ -28,7 +27,7 @@ fn test() {
|
||||
// .unwrap());
|
||||
|
||||
funk(); //dontchangeme
|
||||
// or me
|
||||
// or me
|
||||
}
|
||||
|
||||
/// test123
|
||||
|
Loading…
Reference in New Issue
Block a user