Skip to content

Commit

Permalink
Fix handling when comment_width > max_width
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-mcallister committed Oct 30, 2017
1 parent 7a2c74c commit c211a44
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/missed_spans.rs
Expand Up @@ -173,17 +173,17 @@ impl<'a> FmtVisitor<'a> {
self.buffer.push_str(" ");
}

let comment_width = if self.config.absolute_comment_width() {
self.config
.comment_width()
.checked_sub(self.block_indent.width())
.unwrap_or(0)
} else {
::std::cmp::min(
self.config.comment_width(),
self.config.max_width() - self.block_indent.width(),
)
};
let comment_width = ::std::cmp::min(
if self.config.absolute_comment_width() {
self.config
.comment_width()
.checked_sub(self.block_indent.width())
.unwrap_or(0)
} else {
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(
Expand Down

0 comments on commit c211a44

Please sign in to comment.