about summary refs log tree commit diff
path: root/compiler/rustc_session/src/filesearch.rs
diff options
context:
space:
mode:
authorklensy <klensy@users.noreply.github.com>2025-06-17 13:59:53 +0300
committerklensy <klensy@users.noreply.github.com>2025-06-17 13:59:53 +0300
commit8c83935cdf87d4e3c0d9e7796fc810fb54ecbf39 (patch)
treeb1c85aae31c3fcadcb2f0be6457f7cf87c494e23 /compiler/rustc_session/src/filesearch.rs
parent55d436467c351b56253deeba209ae2553d1c243f (diff)
downloadrust-8c83935cdf87d4e3c0d9e7796fc810fb54ecbf39.tar.gz
rust-8c83935cdf87d4e3c0d9e7796fc810fb54ecbf39.zip
apply clippy::or_fun_call
Diffstat (limited to 'compiler/rustc_session/src/filesearch.rs')
-rw-r--r--compiler/rustc_session/src/filesearch.rs10
1 files changed, 5 insertions, 5 deletions
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"))
 }