Skip to content

Commit 4b4810a

Browse files
committed
Resolve range_plus_one pedantic clippy lint
warning: an inclusive range would be more readable --> src/read.rs:403:46 | 403 | let prefix = &err.as_bytes()[..err.utf8_error().valid_up_to() + 1]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use: `..=err.utf8_error().valid_up_to()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/main/index.html#range_plus_one = note: `-W clippy::range-plus-one` implied by `-W clippy::pedantic` = help: to override `-W clippy::pedantic` add `#[allow(clippy::range_plus_one)]`
1 parent 8af71cc commit 4b4810a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/read.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ where
400400
let raw = match String::from_utf8(raw) {
401401
Ok(raw) => raw,
402402
Err(err) => {
403-
let prefix = &err.as_bytes()[..err.utf8_error().valid_up_to() + 1];
403+
let prefix = &err.as_bytes()[..=err.utf8_error().valid_up_to()];
404404
let line = self.raw_buffering_start_position.line
405405
+ memchr::memchr_iter(b'\n', prefix).count();
406406
let column = match memchr::memrchr(b'\n', prefix) {

0 commit comments

Comments
 (0)