another loop fixed
This commit is contained in:
parent
d3ec313b43
commit
0cab98ffe1
@ -1,5 +1,3 @@
|
|||||||
#![cfg_attr(not(feature = "clippy"), allow(needless_range_loop))]
|
|
||||||
|
|
||||||
use super::{
|
use super::{
|
||||||
LENGTH_BYTES,
|
LENGTH_BYTES,
|
||||||
};
|
};
|
||||||
@ -79,10 +77,10 @@ pub fn decode_length(bytes: &[u8], index: usize, length_bytes: usize)
|
|||||||
return Err(DecodeError::TooShort);
|
return Err(DecodeError::TooShort);
|
||||||
};
|
};
|
||||||
let mut len: usize = 0;
|
let mut len: usize = 0;
|
||||||
for i in index..index+length_bytes {
|
for (i, byte) in bytes.iter().enumerate().take(index+length_bytes).skip(index) {
|
||||||
let offset = (index+length_bytes - i - 1) * 8;
|
let offset = (index+length_bytes - i - 1) * 8;
|
||||||
len |= (bytes[i] as usize) << offset;
|
len |= (*byte as usize) << offset;
|
||||||
};
|
}
|
||||||
Ok(len)
|
Ok(len)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user