Skip to content

Commit 99c0071

Browse files
committed
zlib: bind the unconsumed input with an if expression
Choose between the empty slice and the rest of the input in one expression instead of reassigning a mutable binding. Assisted-by: Claude Code:claude-opus-5-5
1 parent b05099f commit 99c0071

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

  • crates/common/src/compression

‎crates/common/src/compression/zlib.rs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -672,11 +672,12 @@ impl Decompressor {
672672

673673
// save unused input: past the end of the stream it is unused_data and
674674
// unconsumed_tail is emptied, otherwise it is the new unconsumed_tail
675-
let mut unconsumed = &data[consumed..];
676-
if stream_end {
677-
unused_data.extend_from_slice(unconsumed);
678-
unconsumed = &[];
679-
}
675+
let unconsumed: &[u8] = if stream_end {
676+
unused_data.extend_from_slice(&data[consumed..]);
677+
&[]
678+
} else {
679+
&data[consumed..]
680+
};
680681
unconsumed_tail.clear();
681682
unconsumed_tail.extend_from_slice(unconsumed);
682683

0 commit comments

Comments
 (0)