clippy fixes
Rust/spacepackets/pipeline/head There was a failure building this commit Details

This commit is contained in:
Robin Müller 2024-03-25 11:47:31 +01:00
parent 3fb2873b91
commit 9d62d66987
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 6 additions and 8 deletions

View File

@ -210,8 +210,7 @@ pub(crate) fn crc_from_raw_data(raw_data: &[u8]) -> Result<u16, ByteConversionEr
return Err(ByteConversionError::FromSliceTooSmall {
found: raw_data.len(),
expected: 2,
}
.into());
});
}
Ok(u16::from_be_bytes(
raw_data[raw_data.len() - 2..raw_data.len()]
@ -253,8 +252,7 @@ pub(crate) fn user_data_from_raw(
_ if current_idx > total_len - 2 => Err(ByteConversionError::FromSliceTooSmall {
found: total_len - 2,
expected: current_idx,
}
.into()),
}),
_ => Ok(&slice[current_idx..total_len - 2]),
}
}

View File

@ -1183,10 +1183,10 @@ impl TryFrom<chrono::DateTime<chrono::Utc>> for CdsTime<DaysLen16Bits> {
fn try_from(dt: chrono::DateTime<chrono::Utc>) -> Result<Self, Self::Error> {
let conversion = ConversionFromChronoDatetime::new(&dt)?;
Ok(Self::generic_from_conversion(
Self::generic_from_conversion(
LengthOfDaySegment::Short16Bits,
conversion,
)?)
)
}
}
@ -1195,10 +1195,10 @@ impl TryFrom<chrono::DateTime<chrono::Utc>> for CdsTime<DaysLen24Bits> {
type Error = CdsError;
fn try_from(dt: chrono::DateTime<chrono::Utc>) -> Result<Self, Self::Error> {
let conversion = ConversionFromChronoDatetime::new(&dt)?;
Ok(Self::generic_from_conversion(
Self::generic_from_conversion(
LengthOfDaySegment::Long24Bits,
conversion,
)?)
)
}
}