about summary refs log tree commit diff
path: root/compiler/rustc_serialize/src/json.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_serialize/src/json.rs')
-rw-r--r--compiler/rustc_serialize/src/json.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_serialize/src/json.rs b/compiler/rustc_serialize/src/json.rs
index 6a398549241..7e08b18cf48 100644
--- a/compiler/rustc_serialize/src/json.rs
+++ b/compiler/rustc_serialize/src/json.rs
@@ -2306,9 +2306,8 @@ impl crate::Decoder for Decoder {
             }
             json => bad!(ExpectedError("String or Object".to_owned(), json.to_string())),
         };
-        let idx = match names.iter().position(|n| *n == &name[..]) {
-            Some(idx) => idx,
-            None => bad!(UnknownVariantError(name)),
+        let Some(idx) = names.iter().position(|n| *n == &name[..]) else {
+            bad!(UnknownVariantError(name));
         };
         f(self, idx)
     }