resolve clippy errors
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
a61bf3093e
commit
81d7d7aabd
10 changed files with 24 additions and 26 deletions
|
@ -57,11 +57,11 @@ pub(crate) fn read_target_uint(mut bytes: &[u8]) -> Result<u128, Error> {
|
|||
let mut buf = [0u8; std::mem::size_of::<u128>()];
|
||||
match MachineInfo::target_endianess() {
|
||||
Endian::Little => {
|
||||
bytes.read(&mut buf)?;
|
||||
bytes.read_exact(&mut buf[..bytes.len()])?;
|
||||
Ok(u128::from_le_bytes(buf))
|
||||
}
|
||||
Endian::Big => {
|
||||
bytes.read(&mut buf[16 - bytes.len()..])?;
|
||||
bytes.read_exact(&mut buf[16 - bytes.len()..])?;
|
||||
Ok(u128::from_be_bytes(buf))
|
||||
}
|
||||
}
|
||||
|
@ -72,11 +72,11 @@ pub(crate) fn read_target_int(mut bytes: &[u8]) -> Result<i128, Error> {
|
|||
let mut buf = [0u8; std::mem::size_of::<i128>()];
|
||||
match MachineInfo::target_endianess() {
|
||||
Endian::Little => {
|
||||
bytes.read(&mut buf)?;
|
||||
bytes.read_exact(&mut buf[..bytes.len()])?;
|
||||
Ok(i128::from_le_bytes(buf))
|
||||
}
|
||||
Endian::Big => {
|
||||
bytes.read(&mut buf[16 - bytes.len()..])?;
|
||||
bytes.read_exact(&mut buf[16 - bytes.len()..])?;
|
||||
Ok(i128::from_be_bytes(buf))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue