Skip to content

Commit 80474a2

Browse files
committed
refactor: Simplify bitwidth iteration with rfind
1 parent a25b553 commit 80474a2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/huffman.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,7 @@ impl EncoderBuilder {
193193
let symbol_count = bitwidthes
194194
.iter()
195195
.enumerate()
196-
.filter(|e| *e.1 > 0)
197-
.next_back()
196+
.rfind(|e| *e.1 > 0)
198197
.map_or(0, |e| e.0)
199198
+ 1;
200199
let builder = Self::new(symbol_count);

0 commit comments

Comments
 (0)