1
Fork 0

Use new module code from libsyntax

This commit is contained in:
Marcus Klaas 2015-07-24 15:29:04 +02:00
parent 609e621a57
commit 3aa03dcc25
5 changed files with 49 additions and 64 deletions

View file

@ -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