-
Notifications
You must be signed in to change notification settings - Fork 179
feat: support formatter alternate display #1049
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: support formatter alternate display #1049
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an inconsistency for no-std. Fixing that should allow us to merge it
e61ab98 to
410c8f3
Compare
|
Hey, I added Display actually doesn't have an alternate form according to the Rust docs, so we always go for edit: it is actually a breaking change because the public |
410c8f3 to
92cd943
Compare
|
@pablodeymo @diegokingston wdyt of the new impl? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
|
Looks good! We need all the commits to be signed and we can merge it! |
|
@diegokingston my commits are not signed by default? How do I fix this? Also, codecov failed, probably because I'm pushing from a fork, wdyt? |
|
I guess you need to configure your signing key https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits or check if you're using one password https://developer.1password.com/docs/ssh/git-commit-signing/. You have a way of signing everything "git rebase --exec 'git commit --amend --no-edit -n -S' -i main" though you may need to use "git push --force-with-lease". Uploading codecov is not a problem, that's something I can solve on our side |
92cd943 to
3eca081
Compare
|
@diegokingston done, my commits are signed and verified |
Rust formatting for hex representation used the
alternateformatted attribute to decide if the0xprefix should be used or not.You are not doing it.
This causes an issue downstream in https://github.com/starknet-io/types-rs, forcing me to do intermediate string allocation to strip the prefix and then really it if actually specified in the formater
See: https://github.com/starknet-io/types-rs/blob/main/crates/starknet-types-core/src/felt/alloc_impls.rs#L29-L35
Also, this is a breaking change, as all the previous uses without
{:#}will now print without0x, and only the ones with{:#}will print0x...So maybe we want to do the opposite:
0xbeing the default and no0xbeing the alternate. It's a bit quirky, as it opposes the way Rust lang'sLowerHexandUpperHextraits handle this, but it would still work.Also, I fixed this single instance because it is the one I depend on, but it may be a more widespread issue across the rest of your codebase.
Also, you could probably implement LowerHex and UpperHex and handle sign, padding, alternate, etc correctly