Skip to content

Commit

Permalink
fix clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
stbuehler committed Jun 24, 2024
1 parent 00aee1b commit ab1e556
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cidr/direct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ mod tests {
Ipv4Addr::new(1, 2, 3, 2),
Ipv4Addr::new(1, 2, 3, 3),
],
(&cidr).into_iter().addresses().collect::<Vec<_>>()
cidr.into_iter().addresses().collect::<Vec<_>>()
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/parsers/inetaddr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ pub fn inet_addr(s: &str) -> Option<Ipv4Addr> {
slots[0]
} else {
let mut base: u32 = 0;
for ndx in 0..last_slot {
if slots[ndx] >= 256 {
for (ndx, &slot) in slots.iter().enumerate().take(last_slot) {
if slot >= 256 {
// leading parts must be octects
return None;
}
// shift by 24, 16 or 8
base = base | (slots[ndx] << (3 - ndx) * 8);
base |= slots[ndx] << ((3 - ndx) * 8);
}
// last 3 => have 4 => 1 byte, last 2 => have 3 => 2 bytes, last 1 => have 2 => 3 bytes
let last_slot_bit_limit = (4 - last_slot) * 8;
Expand Down

0 comments on commit ab1e556

Please sign in to comment.