use checked addition with range (#438)

This commit is contained in:
Carl Lerche
2020-10-20 10:26:38 -07:00
committed by GitHub
parent e0d8413d53
commit 5866839e45
+1 -1
View File
@@ -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,
};