Skip to content

Commit

Permalink
make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Borcherding committed Nov 22, 2024
1 parent b94d208 commit 9e665fe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/encoding/bit_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl BitWriter<&mut Vec<u8>> {}

impl<V: AsMut<Vec<u8>>> BitWriter<V> {
/// Initialize a new writer.
pub fn from<'a>(mut output: V) -> BitWriter<V> {
pub fn from(mut output: V) -> BitWriter<V> {
BitWriter {
bit_idx: output.as_mut().len() * 8,
output,
Expand Down
5 changes: 0 additions & 5 deletions src/encoding/match_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,11 @@ impl<'data> MatchGenerator<'data> {

fn reserve(&mut self, amount: usize) {
assert!(self.max_window_size > amount);
let mut removed_slices = 0;
while self.window_size + amount > self.max_window_size {
let removed = self.window.remove(0);
self.window_size -= removed.data.len();
#[cfg(debug_assertions)]
self.concat_window.drain(0..removed.data.len());
removed_slices += 1;
}
if removed_slices == 0 {
return;
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/fse/fse_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,28 +356,28 @@ fn next_position(mut p: usize, table_size: usize) -> usize {
p
}

const ML_DIST: &'static [i32] = &[
const ML_DIST: &[i32] = &[
1, 4, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1,
];

const LL_DIST: &'static [i32] = &[
const LL_DIST: &[i32] = &[
4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 1, 1, 1, 1, 1,
-1, -1, -1, -1,
];

const OF_DIST: &'static [i32] = &[
const OF_DIST: &[i32] = &[
1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1,
];

pub(crate) fn default_ml_table() -> FSETable {
build_table_from_probabilities(&ML_DIST, 6)
build_table_from_probabilities(ML_DIST, 6)
}

pub(crate) fn default_ll_table() -> FSETable {
build_table_from_probabilities(&LL_DIST, 6)
build_table_from_probabilities(LL_DIST, 6)
}

pub(crate) fn default_of_table() -> FSETable {
build_table_from_probabilities(&OF_DIST, 5)
build_table_from_probabilities(OF_DIST, 5)
}
2 changes: 1 addition & 1 deletion src/huff0/huff0_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl<V: AsMut<Vec<u8>>> HuffmanEncoder<'_, V> {
}
pub fn encode(&mut self, data: &[u8]) {
self.write_table();
Self::encode_stream(&self.table, &mut self.writer, data);
Self::encode_stream(&self.table, self.writer, data);
}
pub fn encode4x(&mut self, data: &[u8]) {
assert!(data.len() >= 4);
Expand Down

0 comments on commit 9e665fe

Please sign in to comment.