Skip to content

Commit

Permalink
Make BeginToken offset nonnegative
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jan 7, 2022
1 parent ba6401d commit e2892b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct BreakToken {

#[derive(Clone, Copy)]
pub struct BeginToken {
pub offset: isize,
pub offset: usize,
pub breaks: Breaks,
}

Expand Down Expand Up @@ -220,7 +220,7 @@ impl Printer {

fn print_begin(&mut self, token: BeginToken, size: isize) {
if size > self.space {
let col = self.margin - self.space + token.offset;
let col = self.margin - self.space + token.offset as isize;
self.print_stack.push(PrintFrame::Broken(col, token.breaks));
} else {
self.print_stack.push(PrintFrame::Fits);
Expand Down
2 changes: 1 addition & 1 deletion src/convenience.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ impl Printer {
// "raw box"
pub fn rbox(&mut self, indent: usize, b: Breaks) {
self.scan_begin(BeginToken {
offset: indent as isize,
offset: indent,
breaks: b,
});
}
Expand Down

0 comments on commit e2892b0

Please sign in to comment.