diff options
Diffstat (limited to 'src/expr.rs')
| -rw-r--r-- | src/expr.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/expr.rs b/src/expr.rs index cb5188017fd..c5b6f497de5 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -347,9 +347,11 @@ fn rewrite_binary_op(context: &RewriteContext, result.push(' '); result.push_str(&operator_str); + // 1 = space between operator and rhs + let used_width = result.len() + operator_str.len() + 1; let remaining_width = match result.rfind('\n') { - Some(idx) => (offset + width + idx).checked_sub(result.len()).unwrap_or(0), - None => width.checked_sub(result.len()).unwrap_or(0) + Some(idx) => (offset + width + idx).checked_sub(used_width).unwrap_or(0), + None => width.checked_sub(used_width).unwrap_or(0) }; // Get "full width" rhs and see if it fits on the current line. This |
