1
Fork 0

Merge pull request #158 from marcusklaas/modules

Use new module code from libsyntax
This commit is contained in:
Nick Cameron 2015-07-25 09:48:58 +12:00
commit 4aa24f5962
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