From 2b8c7a3813f5d0ce3de8b8510a81b0f423e168e0 Mon Sep 17 00:00:00 2001 From: Pavel Grigorenko Date: Mon, 24 Jun 2024 17:57:58 +0300 Subject: [PATCH] Small fixme in core now that split_first has no codegen issues --- core/src/num/dec2flt/common.rs | 4 +--- core/src/num/dec2flt/parse.rs | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/src/num/dec2flt/common.rs b/core/src/num/dec2flt/common.rs index 11a626485191c..c85727b493816 100644 --- a/core/src/num/dec2flt/common.rs +++ b/core/src/num/dec2flt/common.rs @@ -39,9 +39,7 @@ impl ByteSlice for [u8] { fn parse_digits(&self, mut func: impl FnMut(u8)) -> &Self { let mut s = self; - // FIXME: Can't use s.split_first() here yet, - // see https://github.com/rust-lang/rust/issues/109328 - while let [c, s_next @ ..] = s { + while let Some((c, s_next)) = s.split_first() { let c = c.wrapping_sub(b'0'); if c < 10 { func(c); diff --git a/core/src/num/dec2flt/parse.rs b/core/src/num/dec2flt/parse.rs index b0a23835c5bd4..975bb8ad6bc1f 100644 --- a/core/src/num/dec2flt/parse.rs +++ b/core/src/num/dec2flt/parse.rs @@ -51,9 +51,7 @@ fn try_parse_19digits(s_ref: &mut &[u8], x: &mut u64) { let mut s = *s_ref; while *x < MIN_19DIGIT_INT { - // FIXME: Can't use s.split_first() here yet, - // see https://github.com/rust-lang/rust/issues/109328 - if let [c, s_next @ ..] = s { + if let Some((c, s_next)) = s.split_first() { let digit = c.wrapping_sub(b'0'); if digit < 10 {