about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/binary_search_util
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2022-02-19 00:48:49 +0100
committerest31 <MTest31@outlook.com>2022-02-19 17:27:43 +0100
commit2ef8af66196f7cc270a0532ea989f2fc6bc6885d (patch)
treee023e65e895d79575848f47b3d00129f9c5a9f0f /compiler/rustc_data_structures/src/binary_search_util
parentb8c56fa8c30821129b0960180f528d4a1a4f9316 (diff)
downloadrust-2ef8af66196f7cc270a0532ea989f2fc6bc6885d.tar.gz
rust-2ef8af66196f7cc270a0532ea989f2fc6bc6885d.zip
Adopt let else in more places
Diffstat (limited to 'compiler/rustc_data_structures/src/binary_search_util')
-rw-r--r--compiler/rustc_data_structures/src/binary_search_util/mod.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_data_structures/src/binary_search_util/mod.rs b/compiler/rustc_data_structures/src/binary_search_util/mod.rs
index bf09b2f8eef..d40172a2e2f 100644
--- a/compiler/rustc_data_structures/src/binary_search_util/mod.rs
+++ b/compiler/rustc_data_structures/src/binary_search_util/mod.rs
@@ -10,9 +10,8 @@ pub fn binary_search_slice<'d, E, K>(data: &'d [E], key_fn: impl Fn(&E) -> K, ke
 where
     K: Ord,
 {
-    let mid = match data.binary_search_by_key(key, &key_fn) {
-        Ok(mid) => mid,
-        Err(_) => return &[],
+    let Ok(mid) = data.binary_search_by_key(key, &key_fn) else {
+        return &[];
     };
     let size = data.len();