Skip to content

Commit

Permalink
address all warnings (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleades authored Nov 19, 2023
1 parent 9daed8d commit b67fe6e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 3 additions & 1 deletion benches/sherlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ impl Model for StringModel {
}

fn symbol(&self, value: Self::B) -> Option<Self::Symbol> {
self.fenwick_model.symbol(value).map(|x| x as u8)
self.fenwick_model
.symbol(value)
.map(|x| u8::try_from(x).unwrap())
}

fn max_denominator(&self) -> Self::B {
Expand Down
7 changes: 3 additions & 4 deletions examples/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ where
println!("input bytes: {input_bytes}");
println!("output bytes: {output_bytes}");

println!(
"compression ratio: {}",
input_bytes as f32 / output_bytes as f32
);
#[allow(clippy::cast_precision_loss)]
let compression_ratio = input_bytes as f32 / output_bytes as f32;
println!("compression ratio: {compression_ratio}");

let output = decode(model, &buffer);

Expand Down
7 changes: 3 additions & 4 deletions examples/sherlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,9 @@ fn main() {
println!("input bytes: {input_bytes}");
println!("output bytes: {output_bytes}");

println!(
"compression ratio: {}",
input_bytes as f32 / output_bytes as f32
);
#[allow(clippy::cast_precision_loss)]
let compression_ratio = input_bytes as f32 / output_bytes as f32;
println!("compression ratio: {compression_ratio}");

// println!("buffer: {:?}", &buffer);

Expand Down
1 change: 1 addition & 0 deletions src/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ where
/// # Errors
///
/// This method can fail if the underlying [`BitRead`] cannot be read from.
#[allow(clippy::missing_panics_doc)]
pub fn decode(&mut self) -> io::Result<Option<M::Symbol>> {
self.state.initialise()?;

Expand Down

0 comments on commit b67fe6e

Please sign in to comment.