diff options
| author | est31 <MTest31@outlook.com> | 2022-02-19 00:48:49 +0100 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2022-02-19 17:27:43 +0100 |
| commit | 2ef8af66196f7cc270a0532ea989f2fc6bc6885d (patch) | |
| tree | e023e65e895d79575848f47b3d00129f9c5a9f0f /compiler/rustc_serialize | |
| parent | b8c56fa8c30821129b0960180f528d4a1a4f9316 (diff) | |
| download | rust-2ef8af66196f7cc270a0532ea989f2fc6bc6885d.tar.gz rust-2ef8af66196f7cc270a0532ea989f2fc6bc6885d.zip | |
Adopt let else in more places
Diffstat (limited to 'compiler/rustc_serialize')
| -rw-r--r-- | compiler/rustc_serialize/src/json.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_serialize/src/lib.rs | 1 |
2 files changed, 3 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) } diff --git a/compiler/rustc_serialize/src/lib.rs b/compiler/rustc_serialize/src/lib.rs index b31fbab20ac..bd257dc6464 100644 --- a/compiler/rustc_serialize/src/lib.rs +++ b/compiler/rustc_serialize/src/lib.rs @@ -15,6 +15,7 @@ Core encoding and decoding interfaces. #![feature(min_specialization)] #![feature(core_intrinsics)] #![feature(maybe_uninit_slice)] +#![feature(let_else)] #![feature(new_uninit)] #![cfg_attr(test, feature(test))] #![allow(rustc::internal)] |
