You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/chunk.rs
+14-18Lines changed: 14 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ impl RawGenericChunk {
23
23
let chunk_length = chunk_bytes.len();
24
24
25
25
if chunk_length < 12{
26
-
returnErr(error::DmiError::Generic(format!("Failed to load Chunk. Supplied reader contained size of {} bytes, lower than the required 12.", chunk_length)));
26
+
returnErr(error::DmiError::Generic(format!("Failed to load Chunk. Supplied reader contained size of {chunk_length} bytes, lower than the required 12.")));
"Failed to load Chunk. Type contained unlawful characters: {:#?}",
50
-
chunk_type
49
+
"Failed to load Chunk. Type contained unlawful characters: {chunk_type:#?}",
51
50
)));
52
51
};
53
52
@@ -61,9 +60,10 @@ impl RawGenericChunk {
61
60
];
62
61
63
62
let recalculated_crc = crc::calculate_chunk_data_crc(chunk_type,&data);
64
-
if u32::from_be_bytes(crc) != recalculated_crc {
63
+
let crc_le = u32::from_be_bytes(crc);
64
+
if crc_le != recalculated_crc {
65
65
let chunk_name = String::from_utf8(chunk_type.to_vec())?;
66
-
returnErr(error::DmiError::Generic(format!("Failed to load Chunk of type {}. Supplied CRC invalid: {:#?}. Its value ({}) does not match the recalculated one ({}).", chunk_name, crc,u32::from_be_bytes(crc), recalculated_crc)));
66
+
returnErr(error::DmiError::Generic(format!("Failed to load Chunk of type {chunk_name}. Supplied CRC invalid: {crc:#?}. Its value ({crc_le}) does not match the recalculated one ({recalculated_crc}).")));
0 commit comments