Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DRiKE committed Nov 15, 2023
1 parent 6d14b74 commit 2573278
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,18 @@ impl<'a, Octs: ?Sized> Parser<'a, Octs> {

let pos = match range.start_bound() {
Bound::Unbounded => 0,
Bound::Included(0) => 0,
Bound::Included(n) => {
if octets_len == 0 || *n > octets_len - 1 {
if *n + 1 > octets_len {
panic!("range start is out of range for octets")
}
*n
}
Bound::Excluded(_) => unreachable!() // not a thing for the
// start_bound, right?
Bound::Excluded(n) => {
if *n + 2 > octets_len {
panic!("range start is out of range for octets")
}
*n + 1
}
};

let len = match range.end_bound() {
Expand Down

0 comments on commit 2573278

Please sign in to comment.