1
Fork 0

Fix width computation in rewrite_binary_op

Operator width was counted twice.
This commit is contained in:
Gaëtan Cassiers 2015-07-25 18:58:16 +02:00
parent 8461e8a0a8
commit ff301efa4e
3 changed files with 4 additions and 3 deletions

View file

@ -608,7 +608,7 @@ fn rewrite_binary_op(context: &RewriteContext,
result.push_str(&operator_str);
// 1 = space between operator and rhs
let used_width = result.len() + operator_str.len() + 1;
let used_width = result.len() + 1;
let remaining_width = match result.rfind('\n') {
Some(idx) => (offset + width + idx).checked_sub(used_width).unwrap_or(0),
None => width.checked_sub(used_width).unwrap_or(0)