mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-12 12:06:47 +00:00
Fix width computation in rewrite_binary_op
Operator width was counted twice.
This commit is contained in:
parent
8461e8a0a8
commit
ff301efa4e
@ -608,7 +608,7 @@ fn rewrite_binary_op(context: &RewriteContext,
|
||||
result.push_str(&operator_str);
|
||||
|
||||
// 1 = space between operator and rhs
|
||||
let used_width = result.len() + operator_str.len() + 1;
|
||||
let used_width = result.len() + 1;
|
||||
let remaining_width = match result.rfind('\n') {
|
||||
Some(idx) => (offset + width + idx).checked_sub(used_width).unwrap_or(0),
|
||||
None => width.checked_sub(used_width).unwrap_or(0)
|
||||
|
@ -7,6 +7,7 @@ fn foo() -> bool {
|
||||
let very_long_variable_name = ( a + first + simple + test );
|
||||
let very_long_variable_name = (a + first + simple + test + AAAAAAAAAAAAA + BBBBBBBBBBBBBBBBB + b + c);
|
||||
|
||||
//FIXME this exceeds width limit. Needs assignments reformatting
|
||||
let is_internalxxxx = self.codemap.span_to_filename(s) == self.codemap.span_to_filename(m.inner);
|
||||
|
||||
let some_val = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * bbbb / (bbbbbb -
|
||||
|
@ -8,8 +8,8 @@ fn foo() -> bool {
|
||||
let very_long_variable_name = (a + first + simple + test + AAAAAAAAAAAAA + BBBBBBBBBBBBBBBBB +
|
||||
b + c);
|
||||
|
||||
let is_internalxxxx = self.codemap.span_to_filename(s) ==
|
||||
self.codemap.span_to_filename(m.inner);
|
||||
//FIXME this exceeds width limit. Needs assignments reformatting
|
||||
let is_internalxxxx = self.codemap.span_to_filename(s) == self.codemap.span_to_filename(m.inner);
|
||||
|
||||
let some_val = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * bbbb /
|
||||
(bbbbbb - function_call(x, *very_long_pointer, y)) + 1000;
|
||||
|
Loading…
Reference in New Issue
Block a user