Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zarvd committed Aug 21, 2024
1 parent 027bd2e commit 819e66d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/cidr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,7 @@ impl Iterator for Ipv4Hosts {
None => return (usize::MAX, None),
};

if let Ok(n) = usize::try_from(n) {
(n, Some(n))
} else {
(usize::MAX, None)
}
usize::try_from(n).map_or((usize::MAX, None), |n| (n, Some(n)))
}

fn count(self) -> usize
Expand Down Expand Up @@ -634,11 +630,7 @@ impl Iterator for Ipv6Hosts {
None => return (usize::MAX, None),
};

if let Ok(n) = usize::try_from(n) {
(n, Some(n))
} else {
(usize::MAX, None)
}
usize::try_from(n).map_or((usize::MAX, None), |n| (n, Some(n)))
}

fn count(self) -> usize
Expand Down

0 comments on commit 819e66d

Please sign in to comment.