Skip to content

Commit

Permalink
replacing sub's that can wrap by saturating_sub's
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-anssi committed Sep 11, 2020
1 parent 94b4de0 commit 439b766
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,15 +959,15 @@ impl EmitterWriter {
'_',
line_offset + pos,
width_offset + depth,
code_offset + annotation.start_col - left,
(code_offset + annotation.start_col).saturating_sub(left),
style,
);
}
_ if self.teach => {
buffer.set_style_range(
line_offset,
code_offset + annotation.start_col - left,
code_offset + annotation.end_col - left,
(code_offset + annotation.start_col).saturating_sub(left),
(code_offset + annotation.end_col).saturating_sub(left),
style,
annotation.is_primary,
);
Expand Down

0 comments on commit 439b766

Please sign in to comment.