Skip to content

Commit a4b7e65

Browse files
committed
Auto merge of rust-lang#88066 - LeSeulArtichaut:patterns-cleanups, r=nagisa
Use if-let guards in the codebase and various other pattern cleanups Dogfooding if-let guards as experimentation for the feature. Tracking issue rust-lang#51114. Conflicts with rust-lang#87937.
2 parents df39053 + f6d2760 commit a4b7e65

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

core/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
#![warn(missing_debug_implementations)]
7070
#![warn(missing_docs)]
7171
#![allow(explicit_outlives_requirements)]
72+
#![cfg_attr(bootstrap, allow(incomplete_features))] // if_let_guard
7273
//
7374
// Library features for const fns:
7475
#![feature(const_align_of_val)]
@@ -134,6 +135,7 @@
134135
#![feature(exhaustive_patterns)]
135136
#![feature(extern_types)]
136137
#![feature(fundamental)]
138+
#![feature(if_let_guard)]
137139
#![feature(intra_doc_pointers)]
138140
#![feature(intrinsics)]
139141
#![feature(lang_items)]

core/src/num/dec2flt/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,8 @@ pub fn dec2flt<F: RawFloat>(s: &str) -> Result<F, ParseFloatError> {
236236

237237
let num = match parse_number(s, negative) {
238238
Some(r) => r,
239-
None => {
240-
if let Some(value) = parse_inf_nan(s, negative) {
241-
return Ok(value);
242-
} else {
243-
return Err(pfe_invalid());
244-
}
245-
}
239+
None if let Some(value) = parse_inf_nan(s, negative) => return Ok(value),
240+
None => return Err(pfe_invalid()),
246241
};
247242
if let Some(value) = num.try_fast_path::<F>() {
248243
return Ok(value);

0 commit comments

Comments
 (0)