Skip to content

Commit

Permalink
Replace .rev().next() with .next_back()
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralith authored and djc committed Jul 19, 2023
1 parent 53083f4 commit 72e9e3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion quinn-proto/src/range_set/array_range_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,6 @@ impl ArrayRangeSet {
}

pub fn max(&self) -> Option<u64> {
self.iter().rev().next().map(|x| x.end - 1)
self.iter().next_back().map(|x| x.end - 1)
}
}
5 changes: 2 additions & 3 deletions quinn-proto/src/range_set/btree_range_set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ impl RangeSet {
fn pred(&self, x: u64) -> Option<(u64, u64)> {
self.0
.range((Included(0), Included(x)))
.rev()
.next()
.next_back()
.map(|(&x, &y)| (x, y))
}

Expand Down Expand Up @@ -181,7 +180,7 @@ impl RangeSet {
self.iter().next().map(|x| x.start)
}
pub fn max(&self) -> Option<u64> {
self.iter().rev().next().map(|x| x.end - 1)
self.iter().next_back().map(|x| x.end - 1)
}

pub fn len(&self) -> usize {
Expand Down

0 comments on commit 72e9e3b

Please sign in to comment.