change unwrap_or to unwrap_or_else

i18n
mrshmllow 2 years ago committed by Michal
parent 7dd7735e06
commit 306ad5717c

@ -51,7 +51,12 @@ impl ShellCommand {
}
pub fn sudo() -> Self {
Self::new(config::read().bin.sudo.unwrap_or("sudo".to_string()))
Self::new(
config::read()
.bin
.sudo
.unwrap_or_else(|| "sudo".to_string()),
)
}
pub fn rm() -> Self {
@ -146,7 +151,12 @@ impl ShellCommand {
(Stdio::inherit(), Stdio::inherit())
};
let mut command = if self.elevated {
let mut cmd = Command::new(config::read().bin.sudo.unwrap_or("sudo".to_string()));
let mut cmd = Command::new(
config::read()
.bin
.sudo
.unwrap_or_else(|| "sudo".to_string()),
);
cmd.arg(self.command);
cmd

Loading…
Cancel
Save