clippy: fix/allow needless_range_loop
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
0d2133db98
commit
382f10a0cc
@ -51,6 +51,7 @@ pub static IPV4_REVERSE_MASK: &[&str] = &[
|
|||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref IPV4_MASK_HASH_LOCALNET: HashMap<&'static str, u8> = {
|
pub static ref IPV4_MASK_HASH_LOCALNET: HashMap<&'static str, u8> = {
|
||||||
let mut map = HashMap::new();
|
let mut map = HashMap::new();
|
||||||
|
#[allow(clippy::needless_range_loop)]
|
||||||
for i in 8..32 {
|
for i in 8..32 {
|
||||||
map.insert(IPV4_REVERSE_MASK[i], i as u8);
|
map.insert(IPV4_REVERSE_MASK[i], i as u8);
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,9 @@ impl ApiConfig {
|
|||||||
prefix.push_str(components[0]);
|
prefix.push_str(components[0]);
|
||||||
if let Some(subdir) = self.aliases.get(&prefix) {
|
if let Some(subdir) = self.aliases.get(&prefix) {
|
||||||
filename.push(subdir);
|
filename.push(subdir);
|
||||||
for i in 1..comp_len { filename.push(components[i]) }
|
components.iter().skip(1).for_each(|comp| filename.push(comp));
|
||||||
} else {
|
} else {
|
||||||
for i in 0..comp_len { filename.push(components[i]) }
|
components.iter().for_each(|comp| filename.push(comp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filename
|
filename
|
||||||
|
@ -95,19 +95,16 @@ fn decode_volume_statistics(data: &[u8]) -> Result<Lp17VolumeStatistics, Error>
|
|||||||
|
|
||||||
let read_be_counter = |reader: &mut &[u8], len: u8| {
|
let read_be_counter = |reader: &mut &[u8], len: u8| {
|
||||||
let len = len as usize;
|
let len = len as usize;
|
||||||
|
|
||||||
if len == 0 || len > 8 {
|
if len == 0 || len > 8 {
|
||||||
bail!("invalid conter size '{}'", len);
|
bail!("invalid conter size '{}'", len);
|
||||||
}
|
}
|
||||||
let mut buffer = [0u8; 8];
|
let mut buffer = [0u8; 8];
|
||||||
reader.read_exact(&mut buffer[..len])?;
|
reader.read_exact(&mut buffer[..len])?;
|
||||||
|
|
||||||
let mut value: u64 = 0;
|
let value = buffer
|
||||||
|
.iter()
|
||||||
for i in 0..len {
|
.take(len)
|
||||||
value <<= 8;
|
.fold(0, |value, curr| (value << 8) | *curr as u64);
|
||||||
value |= buffer[i] as u64;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(value)
|
Ok(value)
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user