Skip to content

Commit bb38c68

Browse files
committed
core::str::FromStr::from_str(s) => s.parse()
1 parent 6a7102e commit bb38c68

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/de/mod.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,7 @@ mod tests {
968968
assert_eq!(crate::from_str(r#" "👏" "#), Ok(("👏", 8)));
969969

970970
fn s(s: &'static str) -> heapless::String<1024> {
971-
core::str::FromStr::from_str(s).expect("Failed to create test string")
971+
s.parse().expect("Failed to create test string")
972972
}
973973

974974
fn from_str_test<'de, T: serde::Deserialize<'de>>(
@@ -1014,7 +1014,7 @@ mod tests {
10141014
#[test]
10151015
fn tuple_of_str() {
10161016
fn s(s: &'static str) -> heapless::String<1024> {
1017-
core::str::FromStr::from_str(s).expect("Failed to create test string")
1017+
s.parse().expect("Failed to create test string")
10181018
}
10191019

10201020
fn from_str_test<'de, T: serde::Deserialize<'de>>(
@@ -1271,10 +1271,9 @@ mod tests {
12711271
assert_eq!(
12721272
crate::from_str::<Xy>(r#"[10]"#),
12731273
Err(crate::de::Error::CustomErrorWithMessage(
1274-
core::str::FromStr::from_str(
1275-
"invalid length 1, expected tuple struct Xy with 2 elements"
1276-
)
1277-
.unwrap()
1274+
"invalid length 1, expected tuple struct Xy with 2 elements"
1275+
.parse()
1276+
.unwrap()
12781277
))
12791278
);
12801279
assert_eq!(
@@ -1381,9 +1380,7 @@ mod tests {
13811380
use serde::de::Error;
13821381
assert_eq!(
13831382
crate::de::Error::custom("something bad happened"),
1384-
crate::de::Error::CustomErrorWithMessage(
1385-
core::str::FromStr::from_str("something bad happened").unwrap()
1386-
)
1383+
crate::de::Error::CustomErrorWithMessage("something bad happened".parse().unwrap())
13871384
);
13881385
}
13891386

@@ -1393,8 +1390,8 @@ mod tests {
13931390
use serde::de::Error;
13941391
assert_eq!(
13951392
crate::de::Error::custom("0123456789012345678901234567890123456789012345678901234567890123 <- after here the message should be truncated"),
1396-
crate::de::Error::CustomErrorWithMessage(core::str::FromStr::from_str(
1397-
"0123456789012345678901234567890123456789012345678901234567890123").unwrap()
1393+
crate::de::Error::CustomErrorWithMessage(
1394+
"0123456789012345678901234567890123456789012345678901234567890123".parse().unwrap()
13981395
)
13991396
);
14001397
}

0 commit comments

Comments
 (0)