summary refs log tree commit diff
path: root/compiler/rustc_ty_utils/src
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_ty_utils/src
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_ty_utils/src')
-rw-r--r--compiler/rustc_ty_utils/src/abi.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index ad5527f5a77..6a0bfe88c63 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -207,11 +207,8 @@ fn fn_abi_of_instance<'tcx>(
 
     let sig = fn_sig_for_fn_abi(tcx, instance, param_env);
 
-    let caller_location = if instance.def.requires_caller_location(tcx) {
-        Some(tcx.caller_location_ty())
-    } else {
-        None
-    };
+    let caller_location =
+        instance.def.requires_caller_location(tcx).then(|| tcx.caller_location_ty());
 
     fn_abi_new_uncached(
         &LayoutCx { tcx, param_env },