Skip to content

Commit

Permalink
use checked addition with range (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
carllerche committed Oct 20, 2020
1 parent e0d8413 commit 5866839
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/bytes.rs
Expand Up @@ -237,7 +237,7 @@ impl Bytes {
};

let end = match range.end_bound() {
Bound::Included(&n) => n + 1,
Bound::Included(&n) => n.checked_add(1).expect("out of range"),
Bound::Excluded(&n) => n,
Bound::Unbounded => len,
};
Expand Down

0 comments on commit 5866839

Please sign in to comment.