From 8c83935cdf87d4e3c0d9e7796fc810fb54ecbf39 Mon Sep 17 00:00:00 2001 From: klensy Date: Tue, 17 Jun 2025 13:59:53 +0300 Subject: apply clippy::or_fun_call --- compiler/rustc_session/src/filesearch.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'compiler/rustc_session/src') diff --git a/compiler/rustc_session/src/filesearch.rs b/compiler/rustc_session/src/filesearch.rs index def2cc97f06..4f8c3926207 100644 --- a/compiler/rustc_session/src/filesearch.rs +++ b/compiler/rustc_session/src/filesearch.rs @@ -209,10 +209,9 @@ pub fn get_or_default_sysroot() -> PathBuf { // // use `parent` twice to chop off the file name and then also the // directory containing the dll - let dir = dll.parent().and_then(|p| p.parent()).ok_or(format!( - "Could not move 2 levels upper using `parent()` on {}", - dll.display() - ))?; + let dir = dll.parent().and_then(|p| p.parent()).ok_or_else(|| { + format!("Could not move 2 levels upper using `parent()` on {}", dll.display()) + })?; // if `dir` points to target's dir, move up to the sysroot let mut sysroot_dir = if dir.ends_with(crate::config::host_tuple()) { @@ -265,5 +264,6 @@ pub fn get_or_default_sysroot() -> PathBuf { rustlib_path.exists().then_some(p) } - from_env_args_next().unwrap_or(default_from_rustc_driver_dll().expect("Failed finding sysroot")) + from_env_args_next() + .unwrap_or_else(|| default_from_rustc_driver_dll().expect("Failed finding sysroot")) } -- cgit 1.4.1-3-g733a5