mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 13:13:40 +00:00
parent
414a995926
commit
db29f9e0f7
@ -154,21 +154,21 @@ impl<'a> FmtVisitor<'a> {
|
||||
}
|
||||
|
||||
if status.rewrite_next_comment {
|
||||
if fix_indent {
|
||||
let comment_indent = if fix_indent {
|
||||
if let Some('{') = last_char {
|
||||
self.push_str("\n");
|
||||
}
|
||||
let indent_str = self.block_indent.to_string(self.config);
|
||||
self.push_str(&indent_str);
|
||||
self.block_indent
|
||||
} else {
|
||||
self.push_str(" ");
|
||||
}
|
||||
|
||||
Indent::from_width(self.config, last_line_width(&self.buffer))
|
||||
};
|
||||
let comment_width = ::std::cmp::min(
|
||||
self.config.comment_width(),
|
||||
self.config.max_width() - self.block_indent.width(),
|
||||
);
|
||||
let comment_indent = Indent::from_width(self.config, self.buffer.cur_offset());
|
||||
let comment_shape = Shape::legacy(comment_width, comment_indent);
|
||||
let comment_str = rewrite_comment(subslice, false, comment_shape, self.config)
|
||||
.unwrap_or_else(|| String::from(subslice));
|
||||
|
Loading…
Reference in New Issue
Block a user