Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(primitives): update Bytes formatting, add UpperHex #446

Merged
merged 2 commits into from
Dec 5, 2023

Conversation

DaniPopes
Copy link
Member

@DaniPopes DaniPopes commented Dec 5, 2023

Motivation

Don't print "Bytes()" in Debug

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

}
}

impl fmt::LowerHex for Bytes {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(&self.hex_encode())
f.pad(&hex::encode_prefixed(self.as_ref()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should match std behavior here by adding 0x only when fmt.alternate() is true

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(as a drive-by while we're touching this code)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open a new PR for this

@DaniPopes DaniPopes merged commit 398d7e2 into main Dec 5, 2023
21 checks passed
@DaniPopes DaniPopes deleted the dani/bytes-fmt branch December 5, 2023 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants