fix: use associated constants (#191)

This commit is contained in:
Abhishek Chanda
2024-04-30 21:49:56 -05:00
committed by GitHub
parent bb51dee73a
commit f0fd0521e1
2 changed files with 2 additions and 2 deletions

View File

@ -540,7 +540,7 @@ mod test {
fn iterator_v4_huge() {
let cidr: Ipv4Network = "0/0".parse().unwrap();
let mut iter = cidr.iter();
for i in 0..(u32::max_value() as u64 + 1) {
for i in 0..(u32::MAX as u64 + 1) {
assert_eq!(i as u32, u32::from(iter.next().unwrap()));
}
assert_eq!(None, iter.next());

View File

@ -129,7 +129,7 @@ impl Ipv6Network {
/// This can return up to 2^128 addresses, which will take a _long_ time to iterate over.
pub fn iter(&self) -> Ipv6NetworkIterator {
let dec = u128::from(self.addr);
let max = u128::max_value();
let max = u128::MAX;
let prefix = self.prefix;
let mask = max.checked_shl(u32::from(IPV6_BITS - prefix)).unwrap_or(0);