Skip to content

Commit 8e01441

Browse files
committed
Update file names
1 parent fa8b854 commit 8e01441

File tree

3 files changed

+11
-25
lines changed

3 files changed

+11
-25
lines changed

src/expr.rs

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,38 +2060,24 @@ fn rewrite_assignment(
20602060
let lhs_shape = shape.sub_width(operator_str.len() + 1)?;
20612061
let lhs_str = format!("{} {}", lhs.rewrite(context, lhs_shape)?, operator_str);
20622062

2063-
let lhs_lines: Vec<&str> = lhs_str.split("\n").collect();
2064-
2065-
let mut rhs_shape = shape.clone();
2066-
2067-
for line in lhs_lines.into_iter().rev() {
2068-
let mut indent_width = 0;
2069-
let mut first_char = ' ';
2070-
for char in line.chars() {
2071-
if char != ' ' {
2072-
first_char = char;
2073-
break;
2074-
} else {
2075-
indent_width += 1;
2076-
}
2077-
}
2078-
2079-
if first_char != '/' {
2080-
let indent = Indent::from_width(&context.config, indent_width);
2081-
rhs_shape = Shape::indented(indent, &context.config);
2082-
break;
2083-
}
2084-
}
2063+
let last_line = lhs_str.rsplit_once("\n");
2064+
let my_shape = match last_line {
2065+
Some(line) => {
2066+
println!("line={line:?}");
2067+
println!("{:?}", shape.to_string_with_newline(&context.config));
2068+
shape
2069+
}
2070+
_ => shape,
2071+
};
20852072

2086-
println!("config={:?}", context.config.max_width());
20872073
println!("old shape={shape:?}");
2088-
println!("new shape={rhs_shape:?}");
2074+
println!("new shape={my_shape:?}");
20892075
rewrite_assign_rhs(
20902076
context,
20912077
lhs_str,
20922078
rhs,
20932079
&RhsAssignKind::Expr(&rhs.kind, rhs.span),
2094-
rhs_shape,
2080+
shape,
20952081
)
20962082
}
20972083

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)