Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
james-rms committed Jan 5, 2025
1 parent efdd0b7 commit ba1ae63
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions rust/src/sans_io/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,13 @@ impl LinearReader {
self.currently_reading = ChunkRecord;
continue;
}
if matches!(
decompress!(
uncompressed_len,
&mut state.compressed_remaining,
decompressor
),
None
) {
if decompress!(
uncompressed_len,
&mut state.compressed_remaining,
decompressor
)
.is_none()
{
return Some(Err(McapError::UnexpectedEoc));
}
}
Expand Down Expand Up @@ -612,10 +611,9 @@ impl LinearReader {
let len = check!(len_as_usize(u64::from_le_bytes(
opcode_len_buf[1..9].try_into().unwrap(),
)));
if matches!(
decompress!(9 + len, &mut state.compressed_remaining, decompressor),
None
) {
if decompress!(9 + len, &mut state.compressed_remaining, decompressor)
.is_none()
{
return Some(Err(McapError::UnexpectedEoc));
}
self.decompressed_content.mark_read(9);
Expand Down Expand Up @@ -1130,11 +1128,10 @@ mod tests {
.expect("failed to open file");
let blocksize: usize = 1024;
let mut reader = LinearReader::new();
// iterate through the file to ensure that the iterator does not hang.
while let Some(action) = reader.next_action() {
match action.expect("failed to get next action") {
ReadAction::GetRecord { data: _, opcode } => {
print!("{},", opcode);
}
ReadAction::GetRecord { .. } => {}
ReadAction::NeedMore(_) => {
let read = f
.read(reader.insert(blocksize))
Expand Down

0 comments on commit ba1ae63

Please sign in to comment.