diff options
| author | Nick Cameron <nrc@ncameron.org> | 2015-07-25 09:48:58 +1200 |
|---|---|---|
| committer | Nick Cameron <nrc@ncameron.org> | 2015-07-25 09:48:58 +1200 |
| commit | 4aa24f5962ddfcef3028463f42cf55c047c4e26d (patch) | |
| tree | 3e494559d90a2a562ac82803a88fae8f6429c72a /src/expr.rs | |
| parent | 0fc8c3783699dfb25a68ad922c0853f0326de19f (diff) | |
| parent | 3aa03dcc25ce3b723fe691fc1b97f3dbc5dac36a (diff) | |
Merge pull request #158 from marcusklaas/modules
Use new module code from libsyntax
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 |
