Skip to content

Commit b67fe6e

Browse files
authored
address all warnings (#51)
1 parent 9daed8d commit b67fe6e

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

benches/sherlock.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ impl Model for StringModel {
3838
}
3939

4040
fn symbol(&self, value: Self::B) -> Option<Self::Symbol> {
41-
self.fenwick_model.symbol(value).map(|x| x as u8)
41+
self.fenwick_model
42+
.symbol(value)
43+
.map(|x| u8::try_from(x).unwrap())
4244
}
4345

4446
fn max_denominator(&self) -> Self::B {

examples/common/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ where
5757
println!("input bytes: {input_bytes}");
5858
println!("output bytes: {output_bytes}");
5959

60-
println!(
61-
"compression ratio: {}",
62-
input_bytes as f32 / output_bytes as f32
63-
);
60+
#[allow(clippy::cast_precision_loss)]
61+
let compression_ratio = input_bytes as f32 / output_bytes as f32;
62+
println!("compression ratio: {compression_ratio}");
6463

6564
let output = decode(model, &buffer);
6665

examples/sherlock.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,9 @@ fn main() {
6868
println!("input bytes: {input_bytes}");
6969
println!("output bytes: {output_bytes}");
7070

71-
println!(
72-
"compression ratio: {}",
73-
input_bytes as f32 / output_bytes as f32
74-
);
71+
#[allow(clippy::cast_precision_loss)]
72+
let compression_ratio = input_bytes as f32 / output_bytes as f32;
73+
println!("compression ratio: {compression_ratio}");
7574

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

src/decoder.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ where
113113
/// # Errors
114114
///
115115
/// This method can fail if the underlying [`BitRead`] cannot be read from.
116+
#[allow(clippy::missing_panics_doc)]
116117
pub fn decode(&mut self) -> io::Result<Option<M::Symbol>> {
117118
self.state.initialise()?;
118119

0 commit comments

Comments
 (0)