Skip to content

Commit b4b91d4

Browse files
committed
char::is_whitespace is available even in core now
1 parent f443e17 commit b4b91d4

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

src/lib.rs

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1269,25 +1269,6 @@ where
12691269
F: Fn(&str) -> Result<T, E>,
12701270
T: Clone + Num,
12711271
{
1272-
#[cfg(not(feature = "std"))]
1273-
#[inline]
1274-
fn is_whitespace(c: char) -> bool {
1275-
match c {
1276-
' ' | '\x09'..='\x0d' => true,
1277-
_ if c > '\x7f' => match c {
1278-
'\u{0085}' | '\u{00a0}' | '\u{1680}' => true,
1279-
'\u{2000}'..='\u{200a}' => true,
1280-
'\u{2028}' | '\u{2029}' | '\u{202f}' | '\u{205f}' => true,
1281-
'\u{3000}' => true,
1282-
_ => false,
1283-
},
1284-
_ => false,
1285-
}
1286-
}
1287-
1288-
#[cfg(feature = "std")]
1289-
let is_whitespace = char::is_whitespace;
1290-
12911272
let imag = match s.rfind('j') {
12921273
None => 'i',
12931274
_ => 'j',
@@ -1304,8 +1285,8 @@ where
13041285
// ignore '+'/'-' if part of an exponent
13051286
if (c == b'+' || c == b'-') && !(p == b'e' || p == b'E') {
13061287
// trim whitespace around the separator
1307-
a = &s[..=i].trim_right_matches(is_whitespace);
1308-
b = &s[i + 2..].trim_left_matches(is_whitespace);
1288+
a = &s[..=i].trim_right_matches(char::is_whitespace);
1289+
b = &s[i + 2..].trim_left_matches(char::is_whitespace);
13091290
neg_b = c == b'-';
13101291

13111292
if b.is_empty() || (neg_b && b.starts_with('-')) {

0 commit comments

Comments
 (0)