Skip to content

Commit

Permalink
Merge pull request #78 from danielparks/str_from_utf8
Browse files Browse the repository at this point in the history
Clippy: use `str::from_utf8` instead of creating a `String`.
  • Loading branch information
danielparks authored Dec 6, 2024
2 parents fdac58a + adf3eda commit 2a1c966
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/unescape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,12 @@ fn match_numeric_entity(
assert_next_eq(iter, c, PEEK_MATCH_ERROR);

let hex = slice_while(iter, u8::is_ascii_hexdigit);
u32::from_str_radix(&String::from_utf8(hex.to_vec()).unwrap(), 16)
u32::from_str_radix(core::str::from_utf8(hex).unwrap(), 16)
}
Some(_) => {
// Presumably a decimal entity
let dec = slice_while(iter, u8::is_ascii_digit);
u32::from_str_radix(&String::from_utf8(dec.to_vec()).unwrap(), 10)
u32::from_str_radix(core::str::from_utf8(dec).unwrap(), 10)
}
None => {
// Iterator reached end; do not expand.
Expand Down

0 comments on commit 2a1c966

Please sign in to comment.