From 3aa03dcc25ce3b723fe691fc1b97f3dbc5dac36a Mon Sep 17 00:00:00 2001 From: Marcus Klaas Date: Fri, 24 Jul 2015 15:29:04 +0200 Subject: Use new module code from libsyntax --- src/expr.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/expr.rs') diff --git a/src/expr.rs b/src/expr.rs index 0beaee9dbf2..9c651e1314a 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 -- cgit 1.4.1-3-g733a5