1
Fork 0

resolve clippy errors

Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
onur-ozkan 2024-02-25 01:11:09 +03:00
parent a61bf3093e
commit 81d7d7aabd
10 changed files with 24 additions and 26 deletions

View file

@ -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))
}
}