Skip to content

Commit

Permalink
Clippy: use str::from_utf8 instead of creating a String.
Browse files Browse the repository at this point in the history
  • Loading branch information
danielparks committed Dec 6, 2024
1 parent fdac58a commit adf3eda
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 adf3eda

Please sign in to comment.