From 296300ce46744f0b21527c0316da3e38812f5d18 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sun, 6 Dec 2020 12:04:47 +0100 Subject: [PATCH] Fix clippy suggestions --- build.rs | 2 +- src/main.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 92ca750..a560325 100644 --- a/build.rs +++ b/build.rs @@ -16,7 +16,7 @@ fn main() { } } - let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or(std::env::var_os("OUT_DIR")); + let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR")); let outdir = match var { None => return, Some(outdir) => outdir, diff --git a/src/main.rs b/src/main.rs index 4f52a44..cf0f946 100644 --- a/src/main.rs +++ b/src/main.rs @@ -176,7 +176,7 @@ fn run() -> Result { let path_separator = matches.value_of("path-separator").map(|str| str.to_owned()); let ls_colors = if colored_output { - Some(LsColors::from_env().unwrap_or(LsColors::from_string(DEFAULT_LS_COLORS))) + Some(LsColors::from_env().unwrap_or_else(|| LsColors::from_string(DEFAULT_LS_COLORS))) } else { None }; @@ -344,7 +344,7 @@ fn run() -> Result { .value_of("threads") .map(|n| usize::from_str_radix(n, 10)) .transpose() - .context(format!("Failed to parse number of threads"))? + .context("Failed to parse number of threads")? .map(|n| { if n > 0 { Ok(n)