Skip to content

Commit

Permalink
Merge pull request #658 from uuid-rs/fix/alternate-format
Browse files Browse the repository at this point in the history
Always use hyphenated format regardless of flags
  • Loading branch information
KodrAus authored Feb 1, 2023
2 parents 52197cd + 1af8269 commit b90b820
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions src/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,14 @@ impl fmt::Display for Variant {

impl fmt::LowerHex for Uuid {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.alternate() {
fmt::LowerHex::fmt(self.as_simple(), f)
} else {
fmt::LowerHex::fmt(self.as_hyphenated(), f)
}
fmt::LowerHex::fmt(self.as_hyphenated(), f)
}
}

impl fmt::UpperHex for Uuid {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.alternate() {
fmt::UpperHex::fmt(self.as_simple(), f)
} else {
fmt::UpperHex::fmt(self.as_hyphenated(), f)
}
fmt::UpperHex::fmt(self.as_hyphenated(), f)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1219,8 +1219,8 @@ mod tests {
check!(buf, "{:X}", u, 36, |c| c.is_uppercase()
|| c.is_digit(10)
|| c == '-');
check!(buf, "{:#x}", u, 32, |c| c.is_lowercase() || c.is_digit(10));
check!(buf, "{:#X}", u, 32, |c| c.is_uppercase() || c.is_digit(10));
check!(buf, "{:#x}", u, 36, |c| c.is_lowercase() || c.is_digit(10) || c == '-');
check!(buf, "{:#X}", u, 36, |c| c.is_uppercase() || c.is_digit(10) || c == '-');

check!(buf, "{:X}", u.hyphenated(), 36, |c| c.is_uppercase()
|| c.is_digit(10)
Expand Down

0 comments on commit b90b820

Please sign in to comment.