Skip to content

Commit

Permalink
Update file names
Browse files Browse the repository at this point in the history
  • Loading branch information
johnhuichen committed Sep 1, 2024
1 parent fa8b854 commit 8e01441
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 25 deletions.
36 changes: 11 additions & 25 deletions src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2060,38 +2060,24 @@ fn rewrite_assignment(
let lhs_shape = shape.sub_width(operator_str.len() + 1)?;
let lhs_str = format!("{} {}", lhs.rewrite(context, lhs_shape)?, operator_str);

let lhs_lines: Vec<&str> = lhs_str.split("\n").collect();

let mut rhs_shape = shape.clone();

for line in lhs_lines.into_iter().rev() {
let mut indent_width = 0;
let mut first_char = ' ';
for char in line.chars() {
if char != ' ' {
first_char = char;
break;
} else {
indent_width += 1;
}
}

if first_char != '/' {
let indent = Indent::from_width(&context.config, indent_width);
rhs_shape = Shape::indented(indent, &context.config);
break;
}
}
let last_line = lhs_str.rsplit_once("\n");
let my_shape = match last_line {
Some(line) => {
println!("line={line:?}");
println!("{:?}", shape.to_string_with_newline(&context.config));
shape
}
_ => shape,
};

println!("config={:?}", context.config.max_width());
println!("old shape={shape:?}");
println!("new shape={rhs_shape:?}");
println!("new shape={my_shape:?}");
rewrite_assign_rhs(
context,
lhs_str,
rhs,
&RhsAssignKind::Expr(&rhs.kind, rhs.span),
rhs_shape,
shape,
)
}

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 8e01441

Please sign in to comment.