Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
kenoss committed Dec 17, 2024
1 parent 5ee8434 commit 1d1fb66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ impl Rewrite for UseSegment {
use_tree_list,
// 1 = "{" and "}"
shape
.offset_left(1)
.offset_left_opt(1)
.unknown_error()?
.saturating_sub_width(1),
)?
Expand Down Expand Up @@ -1160,15 +1160,15 @@ impl Rewrite for UseTree {
s.clone()
}
} else {
let Some(ret) = shape.offset_left(rewritten_segment.len()) else {
let Some(ret) = shape.offset_left_opt(rewritten_segment.len()) else {
return Err(RewriteError::ExceedsMaxWidth {
configured_width: shape.width,
span: span.clone(),
});
};
// Check that there is a room for the next "{". If not, return an error for
// retry with newline.
if ret.offset_left(reserved_room_for_brace).is_none() {
if ret.offset_left_opt(reserved_room_for_brace).is_none() {
return Err(RewriteError::ExceedsMaxWidth {
configured_width: shape.width,
span: span.clone(),
Expand Down Expand Up @@ -1221,7 +1221,7 @@ impl Rewrite for UseTree {
result.push_str("::");
// 2 = "::"
shape = shape
.offset_left(2 + segment_str.len())
.offset_left_opt(2 + segment_str.len())
.max_width_error(shape.width, self.span())?;
}
}
Expand Down
8 changes: 0 additions & 8 deletions src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,14 +293,6 @@ impl Shape {
}
}

pub(crate) fn shrink_left(&self, width: usize) -> Option<Shape> {
Some(Shape {
width: self.width.checked_sub(width)?,
indent: self.indent + width,
offset: self.offset + width,
})
}

pub(crate) fn offset_left_opt(&self, delta: usize) -> Option<Shape> {
self.add_offset(delta).sub_width_opt(delta)
}
Expand Down

0 comments on commit 1d1fb66

Please sign in to comment.