From f05132f0eeb7adb2950fbbaec5c73cb4773a65e4 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Wed, 26 Oct 2022 15:24:36 +0200 Subject: [PATCH] format --- src/lib.rs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index fe7641c..c675815 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,9 +26,7 @@ #![deny(missing_docs)] #![deny(rustdoc::missing_doc_code_examples)] -use std::{ - collections::{BinaryHeap}, -}; +use std::collections::BinaryHeap; use bit_vec::BitVec; @@ -117,7 +115,7 @@ impl Huffman { } /// Builds a binary tree, the root is the last node, the leafs are at the start. - /// + /// /// Returns the root index. fn build_tree(tree: &mut [Node; TREE_SIZE], table: &[usize; MAX_SYMBOLS]) -> usize { let mut priority_queue: BinaryHeap = table @@ -125,7 +123,7 @@ impl Huffman { .enumerate() .map(|(index, v)| Node::new(index, *v)) .collect(); - + let mut tree_index = 256; while priority_queue.len() > 1 { @@ -179,11 +177,7 @@ impl Huffman { let mut bits = BitVec::new(); for b in data.iter() { - self.traverse( - &mut bits, - *b as usize, - None, - ) + self.traverse(&mut bits, *b as usize, None) } bits.to_bytes()