about summary refs log tree commit diff
path: root/compiler/rustc_session/src/filesearch.rs
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2023-02-15 11:43:41 +0000
committerMaybe Waffle <waffle.lapkin@gmail.com>2023-02-16 15:26:00 +0000
commit8751fa1a9abda9fc7ced6b03315efbd82310830d (patch)
treef15613d5ca2fa5aadfdde2df1d94907d1798a5bb /compiler/rustc_session/src/filesearch.rs
parentaf3c8b27266e290cf65704284f6862d0f90ee4fc (diff)
downloadrust-8751fa1a9abda9fc7ced6b03315efbd82310830d.tar.gz
rust-8751fa1a9abda9fc7ced6b03315efbd82310830d.zip
`if $c:expr { Some($r:expr) } else { None }` =>> `$c.then(|| $r)`
Diffstat (limited to 'compiler/rustc_session/src/filesearch.rs')
-rw-r--r--compiler/rustc_session/src/filesearch.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_session/src/filesearch.rs b/compiler/rustc_session/src/filesearch.rs
index b6a328908ce..855dde0a614 100644
--- a/compiler/rustc_session/src/filesearch.rs
+++ b/compiler/rustc_session/src/filesearch.rs
@@ -217,7 +217,7 @@ pub fn get_or_default_sysroot() -> Result<PathBuf, String> {
                 // Look for the target rustlib directory in the suspected sysroot.
                 let mut rustlib_path = rustc_target::target_rustlib_path(&p, "dummy");
                 rustlib_path.pop(); // pop off the dummy target.
-                if rustlib_path.exists() { Some(p) } else { None }
+                rustlib_path.exists().then(|| p)
             }
             None => None,
         }