File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,9 @@ impl Model for StringModel {
38
38
}
39
39
40
40
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 ( ) )
42
44
}
43
45
44
46
fn max_denominator ( & self ) -> Self :: B {
Original file line number Diff line number Diff line change 57
57
println ! ( "input bytes: {input_bytes}" ) ;
58
58
println ! ( "output bytes: {output_bytes}" ) ;
59
59
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}" ) ;
64
63
65
64
let output = decode ( model, & buffer) ;
66
65
Original file line number Diff line number Diff line change @@ -68,10 +68,9 @@ fn main() {
68
68
println ! ( "input bytes: {input_bytes}" ) ;
69
69
println ! ( "output bytes: {output_bytes}" ) ;
70
70
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}" ) ;
75
74
76
75
// println!("buffer: {:?}", &buffer);
77
76
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ where
113
113
/// # Errors
114
114
///
115
115
/// This method can fail if the underlying [`BitRead`] cannot be read from.
116
+ #[ allow( clippy:: missing_panics_doc) ]
116
117
pub fn decode ( & mut self ) -> io:: Result < Option < M :: Symbol > > {
117
118
self . state . initialise ( ) ?;
118
119
You can’t perform that action at this time.
0 commit comments