We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
extend
1 parent b9823e6 commit 2d37f94Copy full SHA for 2d37f94
src/lib.rs
@@ -183,11 +183,12 @@ fn compress<T: Clone + Copy + PartialEq>(
183
// `tmp` contains `(index, non-empty-value)` pairs that we can then pass to `fits`. Because
184
// this is such a tight loop, we reuse the same `Vec` to avoid repeated allocations.
185
tmp.clear();
186
- for (i, v) in vec[s * row_length..(s + 1) * row_length].iter().enumerate() {
187
- if *v != empty_val {
188
- tmp.push((i, v));
189
- }
190
+ tmp.extend(
+ vec[s * row_length..(s + 1) * row_length]
+ .iter()
+ .enumerate()
+ .filter(|(_, v)| **v != empty_val),
191
+ );
192
193
let mut d = 0; // displacement value
194
loop {
0 commit comments