fix clippy::{needless_bool, manual_unwrap_or}

This commit is contained in:
Matthias Krüger 2020-12-11 18:08:05 +01:00
parent db6c50998c
commit b7795e135a
5 changed files with 17 additions and 29 deletions

View file

@ -216,9 +216,10 @@ impl<'a, 'tcx> Helper<'a, 'tcx> {
let discr = self.find_switch_discriminant_info(bb, switch)?;
// go through each target, finding a discriminant read, and a switch
let results = discr.targets_with_values.iter().map(|(value, target)| {
self.find_discriminant_switch_pairing(&discr, *target, *value)
});
let results = discr
.targets_with_values
.iter()
.map(|(value, target)| self.find_discriminant_switch_pairing(&discr, *target, *value));
// if the optimization did not apply for one of the targets, then abort
if results.clone().any(|x| x.is_none()) || results.len() == 0 {