Clean up a couple of if-blocks
These were flagged by `cargo clippy`: warning: this `else { if .. }` block can be collapsedv0.7.x
parent
e27f6cb564
commit
fff5926210
|
@ -1,3 +1,5 @@
|
|||
#![allow(clippy::collapsible_if)]
|
||||
|
||||
mod utils;
|
||||
|
||||
use std::cmp;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![allow(unused_mut)]
|
||||
#![allow(clippy::collapsible_if)]
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[allow(dead_code)]
|
||||
|
|
|
@ -1192,10 +1192,8 @@ impl<'b, 'c, 'e> InterfaceInner<'b, 'c, 'e> {
|
|||
Some(lladdr) if lladdr.is_unicast() && target_addr.is_unicast() => {
|
||||
if flags.contains(NdiscNeighborFlags::OVERRIDE) {
|
||||
self.neighbor_cache.fill(ip_addr, lladdr, timestamp)
|
||||
} else {
|
||||
if !self.neighbor_cache.lookup(&ip_addr, timestamp).found() {
|
||||
self.neighbor_cache.fill(ip_addr, lladdr, timestamp)
|
||||
}
|
||||
} else if !self.neighbor_cache.lookup(&ip_addr, timestamp).found() {
|
||||
self.neighbor_cache.fill(ip_addr, lladdr, timestamp)
|
||||
}
|
||||
},
|
||||
_ => (),
|
||||
|
|
|
@ -271,14 +271,10 @@ impl<T: AsRef<[u8]>> Packet<T> {
|
|||
/// Returns `Err(Error::Truncated)` if the buffer is too short.
|
||||
pub fn check_len(&self) -> Result<()> {
|
||||
let len = self.buffer.as_ref().len();
|
||||
if len < field::HEADER_END {
|
||||
if len < field::HEADER_END || len < self.header_len() {
|
||||
Err(Error::Truncated)
|
||||
} else {
|
||||
if len < self.header_len() {
|
||||
Err(Error::Truncated)
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -201,11 +201,9 @@ impl Address {
|
|||
} else {
|
||||
ones = false;
|
||||
}
|
||||
} else {
|
||||
if one {
|
||||
// 1 where 0 was expected
|
||||
return None
|
||||
}
|
||||
} else if one {
|
||||
// 1 where 0 was expected
|
||||
return None
|
||||
}
|
||||
mask >>= 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue