cleaned up excluded_extensions

This commit is contained in:
Lynne Megido 2021-04-28 16:59:09 +10:00
parent d578efa7a4
commit af3d51fcda
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90

View file

@ -147,21 +147,20 @@ impl Parameters {
let mut excluded = vec![]; let mut excluded = vec![];
if let Some(exclude) = self.exclude.as_ref() { if let Some(exclude) = self.exclude.as_ref() {
// add extensions excluded by `-x` // add extensions excluded by `-x`
excluded.append(&mut exclude.iter().map(|ext| ext.as_str()).collect()); excluded.extend(exclude.iter().map(|ext| ext.as_str()));
} }
if let Some(exclude_set) = &self.exclude_set { if let Some(exclude_set) = &self.exclude_set {
// add extensions excluded by `-X` // add extensions excluded by `-X`
excluded.append(&mut exclude_set.extensions()); excluded.extend_from_slice(&exclude_set.extensions());
} }
if excluded.is_empty() { match excluded {
// no extensions to exclude - return none // no extensions to exclude - return none
None x if x.is_empty() => None,
} else {
// excluded doesn't sound like a word anymore // excluded doesn't sound like a word anymore
// tongue twister: enter X-options' excellent extension exclusion // tongue twister: enter X-options' excellent extension exclusion
Some(excluded) x => Some(x)
} }
} }