Skip to content

Commit

Permalink
More clippy fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirbaio committed Jan 4, 2021
1 parent 5cfbfbb commit 223047e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/iface/ethernet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ impl<'b, 'c, 'e> InterfaceInner<'b, 'c, 'e> {
}
}

fn has_neighbor<'a>(&self, addr: &'a IpAddress, timestamp: Instant) -> bool {
fn has_neighbor(&self, addr: &IpAddress, timestamp: Instant) -> bool {
match self.route(addr, timestamp) {
Ok(routed_addr) => {
self.neighbor_cache
Expand Down
6 changes: 3 additions & 3 deletions src/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ impl<'a> Parser<'a> {

fn accept_digit(&mut self, hex: bool) -> Result<u8> {
let digit = self.advance()?;
if digit >= b'0' && digit <= b'9' {
if (b'0'..=b'9').contains(&digit) {
Ok(digit - b'0')
} else if hex && digit >= b'a' && digit <= b'f' {
} else if hex && (b'a'..=b'f').contains(&digit) {
Ok(digit - b'a' + 10)
} else if hex && digit >= b'A' && digit <= b'F' {
} else if hex && (b'A'..=b'F').contains(&digit) {
Ok(digit - b'A' + 10)
} else {
Err(())
Expand Down
2 changes: 1 addition & 1 deletion src/storage/ring_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl<'a, T: 'a> RingBuffer<'a, T> {
/// or return `Err(Error::Exhausted)` if the buffer is full.
///
/// This function is a shortcut for `ring_buf.enqueue_one_with(Ok)`.
pub fn enqueue_one<'b>(&'b mut self) -> Result<&'b mut T> {
pub fn enqueue_one(&mut self) -> Result<&mut T> {
self.enqueue_one_with(Ok)
}

Expand Down
14 changes: 4 additions & 10 deletions src/wire/ipv6option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,6 @@ impl<'a> Ipv6OptionsIterator<'a> {
length, data
}
}

/// Helper function to return an error in the implementation
/// of `Iterator`.
#[inline]
fn return_err(&mut self, err: Error) -> Option<Result<Repr<'a>>> {
self.hit_error = true;
Some(Err(err))
}
}

impl<'a> Iterator for Ipv6OptionsIterator<'a> {
Expand All @@ -332,12 +324,14 @@ impl<'a> Iterator for Ipv6OptionsIterator<'a> {
Some(Ok(repr))
}
Err(e) => {
self.return_err(e)
self.hit_error = true;
Some(Err(e))
}
}
}
Err(e) => {
self.return_err(e)
self.hit_error = true;
Some(Err(e))
}
}
} else {
Expand Down

0 comments on commit 223047e

Please sign in to comment.