1
Fork 0

replacing sub's that can wrap by saturating_sub's

This commit is contained in:
Aurélien Deharbe 2020-09-11 11:11:11 +02:00
parent 94b4de0e07
commit 439b766161

View file

@ -959,15 +959,15 @@ impl EmitterWriter {
'_', '_',
line_offset + pos, line_offset + pos,
width_offset + depth, width_offset + depth,
code_offset + annotation.start_col - left, (code_offset + annotation.start_col).saturating_sub(left),
style, style,
); );
} }
_ if self.teach => { _ if self.teach => {
buffer.set_style_range( buffer.set_style_range(
line_offset, line_offset,
code_offset + annotation.start_col - left, (code_offset + annotation.start_col).saturating_sub(left),
code_offset + annotation.end_col - left, (code_offset + annotation.end_col).saturating_sub(left),
style, style,
annotation.is_primary, annotation.is_primary,
); );