Skip to content

Commit

Permalink
Merge pull request #301 from QuinnPainter/main
Browse files Browse the repository at this point in the history
Use strip_prefix instead of starts_with + slice
  • Loading branch information
KodrAus committed Feb 19, 2023
2 parents 0b84e40 + ca7090e commit 2206e5e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/internal.rs
Expand Up @@ -134,8 +134,7 @@ macro_rules! __impl_internal_bitflags {

// If the flag starts with `0x` then it's a hex number
// Parse it directly to the underlying bits type
let parsed_flag = if flag.starts_with("0x") {
let flag = &flag[2..];
let parsed_flag = if let $crate::__private::core::option::Option::Some(flag) = flag.strip_prefix("0x") {
let bits = <$T>::from_str_radix(flag, 16).map_err(|_| $crate::parser::ParseError::invalid_hex_flag(flag))?;

Self::from_bits_retain(bits)
Expand Down

0 comments on commit 2206e5e

Please sign in to comment.