Skip to content

Commit a39b341

Browse files
authored
fix(style): nightly clippy (#99)
* style(sequence decoder): migrate .is_some() -> .unwrap to if let to make clippy happy * feat(cli): replace unix specific code with os generic variant
1 parent 5873ae9 commit a39b341

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

cli/src/main.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use progress::ProgressMonitor;
44

55
use std::fs::File;
66
use std::io::BufReader;
7-
use std::os::unix::fs::MetadataExt;
87
use std::path::Path;
98
use std::path::PathBuf;
109

@@ -134,7 +133,7 @@ fn compress(input: PathBuf, output: PathBuf, level: u8) -> color_eyre::Result<()
134133
fn decompress(input: PathBuf, output: PathBuf) -> color_eyre::Result<()> {
135134
info!("extracting {input:?} to {output:?}");
136135
let source_file = File::open(input).wrap_err("failed to open input file")?;
137-
let source_size = source_file.metadata()?.size() as usize;
136+
let source_size = source_file.metadata()?.len() as usize;
138137
let buffered_source = BufReader::new(source_file);
139138
let decoder_input = ProgressMonitor::new(buffered_source, source_size);
140139
let mut output: File =

ruzstd/src/decoding/sequence_section_decoder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,18 @@ fn decode_sequences_with_rle(
7171

7272
for _seq_idx in 0..section.num_sequences {
7373
//get the codes from either the RLE byte or from the decoder
74-
let ll_code = if scratch.ll_rle.is_some() {
75-
scratch.ll_rle.unwrap()
74+
let ll_code = if let Some(ll_rle) = scratch.ll_rle {
75+
ll_rle
7676
} else {
7777
ll_dec.decode_symbol()
7878
};
79-
let ml_code = if scratch.ml_rle.is_some() {
80-
scratch.ml_rle.unwrap()
79+
let ml_code = if let Some(ml_rle) = scratch.ml_rle {
80+
ml_rle
8181
} else {
8282
ml_dec.decode_symbol()
8383
};
84-
let of_code = if scratch.of_rle.is_some() {
85-
scratch.of_rle.unwrap()
84+
let of_code = if let Some(of_rle) = scratch.of_rle {
85+
of_rle
8686
} else {
8787
of_dec.decode_symbol()
8888
};

0 commit comments

Comments
 (0)