From eea5c299352d3158434d3da0c1524f54b2a4459b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Wed, 22 Sep 2021 13:14:13 -0700 Subject: [PATCH] fix(read_span): fix off-by-one issue --- src/source_impls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/source_impls.rs b/src/source_impls.rs index bedabc7..49ecc0e 100644 --- a/src/source_impls.rs +++ b/src/source_impls.rs @@ -39,7 +39,7 @@ fn context_info<'a>( start_line += 1; before_lines_starts.remove(0); } - } else if offset >= span.offset() + span.len() - 1 { + } else if offset >= span.offset() + span.len().saturating_sub(1) { // We're after the end of the span, but haven't necessarily // started collecting end lines yet (we might still be // collecting context lines).