From 247c33b6d602abf856fa0381854dab14636a2081 Mon Sep 17 00:00:00 2001 From: Ian Manske Date: Sat, 16 Dec 2023 20:06:42 +0000 Subject: [PATCH] Satisfy clippy lint in benchmark (#11350) Fixes the two `clippy::let_and_return` lints in `benchmark.rs`. --- benches/benchmarks.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/benches/benchmarks.rs b/benches/benchmarks.rs index 7584a55756..498349aee9 100644 --- a/benches/benchmarks.rs +++ b/benches/benchmarks.rs @@ -24,13 +24,9 @@ fn canonicalize_path(engine_state: &EngineState, path: &Path) -> PathBuf { } fn get_home_path(engine_state: &EngineState) -> PathBuf { - let home_path = if let Some(path) = nu_path::home_dir() { - let canon_home_path = canonicalize_path(engine_state, &path); - canon_home_path - } else { - std::path::PathBuf::new() - }; - home_path + nu_path::home_dir() + .map(|path| canonicalize_path(engine_state, &path)) + .unwrap_or_default() } // FIXME: All benchmarks live in this 1 file to speed up build times when benchmarking.