Fix clippy warnings

This commit is contained in:
Joshua Holmer 2016-12-01 22:33:38 -05:00
parent 5958efe958
commit bf341dd20f
3 changed files with 6 additions and 6 deletions

View file

@ -530,7 +530,7 @@ fn optimize_png(mut png: &mut png::PngData, file_original_size: usize, opts: &Op
let best: Option<TrialWithData> = results.into_par_iter()
.weight_max()
.filter_map(|trial| {
let filtered = filters.get(&trial.0).unwrap();
let filtered = &filters[&trial.0];
let new_idat = if opts.deflate == Deflaters::Zlib {
deflate::deflate(filtered, trial.1, trial.2, trial.3, opts.window)
} else {

View file

@ -452,20 +452,20 @@ fn parse_numeric_range_opts(input: &str,
return Err("Not a valid input".to_owned());
}
return Ok(match &captures[2] {
match &captures[2] {
"," => {
items.insert(first);
items.insert(second);
return Ok(items);
}
"-" => {
for i in first..second + 1 {
items.insert(i);
}
return Ok(items);
}
_ => unreachable!(),
});
};
return Ok(items);
}
Err("Not a valid input".to_owned())

View file

@ -485,7 +485,7 @@ impl PngData {
let mut seen: HashMap<&[u8], u8> = HashMap::with_capacity(indexed_palette.len());
for (i, color) in indexed_palette.iter().enumerate() {
if seen.contains_key(color) {
let index = seen.get(color).unwrap();
let index = &seen[color];
duplicates.push(i as u8);
index_map.insert(i as u8, *index);
} else {