Skip to content

Commit

Permalink
refactor(h1): resolve deprecated std::usize
Browse files Browse the repository at this point in the history
  • Loading branch information
tottoto committed Apr 17, 2024
1 parent c78379e commit 59ad587
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/proto/h1/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ fn prev_power_of_two(n: usize) -> usize {
// Only way this shift can underflow is if n is less than 4.
// (Which would means `usize::MAX >> 64` and underflowed!)
debug_assert!(n >= 4);
(::std::usize::MAX >> (n.leading_zeros() + 2)) + 1
(usize::MAX >> (n.leading_zeros() + 2)) + 1
}

impl Default for ReadStrategy {
Expand Down Expand Up @@ -763,7 +763,7 @@ mod tests {
assert_eq!(strategy.next(), 32768);

// Enormous records still increment at same rate
strategy.record(::std::usize::MAX);
strategy.record(usize::MAX);
assert_eq!(strategy.next(), 65536);

let max = strategy.max();
Expand Down Expand Up @@ -833,7 +833,7 @@ mod tests {
fn fuzz(max: usize) {
let mut strategy = ReadStrategy::with_max(max);
while strategy.next() < max {
strategy.record(::std::usize::MAX);
strategy.record(usize::MAX);
}
let mut next = strategy.next();
while next > 8192 {
Expand All @@ -854,7 +854,7 @@ mod tests {
fuzz(max);
max = (max / 2).saturating_mul(3);
}
fuzz(::std::usize::MAX);
fuzz(usize::MAX);
}

#[test]
Expand Down

0 comments on commit 59ad587

Please sign in to comment.