chore: revert clippy settings

* fix: PusError::ByteConversion docstring
* chore: restore legacy PusError::CrcCalculationMissing
This commit is contained in:
Jakub Kołodziej committed 2026-06-06 13:34:28 +02:00
1 parent f9e4214a28
commit f8c337b272
4 files changed
+9 -13

No files matched your search

-3
View File
@@ -46,6 +46,3 @@ tempfile = "3"
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--generate-link-to-definition"]
[lints.clippy]
unwrap_used = "warn"
-2
View File
@@ -1,2 +0,0 @@
allow-unwrap-in-tests = true
allow-unwrap-in-consts = true
+3 -2
View File
@@ -197,8 +197,9 @@ pub enum PusError {
#[error("checksum verification for crc16 {0:#06x} failed")]
ChecksumFailure(u16),
/// CRC16 needs to be calculated first
//#[error("crc16 was not calculated")]
//CrcCalculationMissing,
#[error("crc16 was not calculated")]
CrcCalculationMissing,
/// Raised when converting to and from raw byte slices
#[error("pus error: {0}")]
ByteConversion(#[from] ByteConversionError),
}
+6 -6
View File
@@ -921,7 +921,7 @@ impl<'raw_data> PusTcReader<'raw_data> {
let pus_tc = Self::new_no_checksum_verification(slice, true)?;
verify_crc16_ccitt_false_from_raw_to_pus_error(
pus_tc.raw_data(),
pus_tc.crc16().expect("crc16 checksum shall not be `None`"),
pus_tc.crc16().ok_or(PusError::CrcCalculationMissing)?,
)?;
Ok(pus_tc)
}
@@ -932,7 +932,7 @@ impl<'raw_data> PusTcReader<'raw_data> {
let pus_tc = Self::new_no_checksum_verification(slice, true)?;
verify_crc16_ccitt_false_from_raw_to_pus_error_no_table(
pus_tc.raw_data(),
pus_tc.crc16().expect("crc16 checksum shall not be `None`"),
pus_tc.crc16().ok_or(PusError::CrcCalculationMissing)?,
)?;
Ok(pus_tc)
}
@@ -980,10 +980,10 @@ impl<'raw_data> PusTcReader<'raw_data> {
.unwrap();
current_idx += PUC_TC_SECONDARY_HEADER_LEN;
let raw_data = &slice[0..total_len];
let mut crc16 = None;
if has_checksum {
crc16 = Some(crc_from_raw_data(&slice[total_len - 2..total_len])?);
}
let crc16 = match has_checksum {
true => Some(crc_from_raw_data(&slice[total_len - 2..total_len])?),
false => None,
};
Ok(Self {
sp_header,
sec_header: PusTcSecondaryHeader::try_from(sec_header).unwrap(),