diff --git a/src/bin/bombadil.rs b/src/bin/bombadil.rs index 2197fdae..c8e00b5c 100644 --- a/src/bin/bombadil.rs +++ b/src/bin/bombadil.rs @@ -131,11 +131,9 @@ fn main() { let mut bombadil = Bombadil::from_settings(Mode::Gpg).unwrap_or_else(|err| fatal!("{}", err)); - if !profiles.is_empty() { - bombadil - .enable_profiles(profiles.iter().map(String::as_str).collect()) - .unwrap_or_else(|err| fatal!("{}", err)); - } + bombadil + .enable_profiles(profiles.iter().map(String::as_str).collect()) + .unwrap_or_else(|err| fatal!("{}", err)); bombadil.install().unwrap_or_else(|err| fatal!("{}", err)); } @@ -196,11 +194,9 @@ fn main() { } .unwrap_or_else(|err| fatal!("{}", err)); - if !profiles.is_empty() { - bombadil - .enable_profiles(profiles.iter().map(String::as_str).collect()) - .unwrap_or_else(|err| fatal!("{}", err)); - } + bombadil + .enable_profiles(profiles.iter().map(String::as_str).collect()) + .unwrap_or_else(|err| fatal!("{}", err)); bombadil.print_metadata(metadata_type); } diff --git a/src/lib.rs b/src/lib.rs index d289dadc..029f0638 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -233,6 +233,10 @@ impl Bombadil { /// Enable a dotfile profile by merging its config with the default profile pub fn enable_profiles(&mut self, profile_keys: Vec<&str>) -> Result<()> { + if profile_keys.is_empty() { + return Ok(()); + } + let mut profiles: Vec = profile_keys .iter() // unwrap here is safe cause allowed profile keys are checked by clap