-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
std: Deprecate 'x'/'X'/'e'/'E' special cases for u8 slices #8007
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
Conversation
Maybe |
No. |
Rebased, note that this reverts #8031 as the deprecation warnings were added (and removed) within the same release. |
Let's follow the road paved by the removal of 'z'/'Z', the Formatter pattern is nice enough to let us remove the remaining four special cases and declare u8 slices free from any special casing!
|
||
/// Return a Formatter for a []const u8 where every byte is formatted as a pair | ||
/// of uppercase hexadecimal digits. | ||
pub fn fmtSliceHexUpper(bytes: []const u8) std.fmt.Formatter(formatSliceHexUpper) { |
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.
I don't love that we have different functions for this for upper vs lower case.
Could we instead take the case as an argument?
pub fn fmtSliceHex(bytes: []const u8, case: enum{Upper, Lower}) std.fmt.Formatter(formatSliceHex) {
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.
No strong opinion on having a single formatter, I went with two separate ones to keep it close to the x
/ X
.
(IIRC there's a stage1 bug regarding comptime anonymous enum arguments, check out #3707)
Following ziglang#8007 and ziglang#8137 let's get rid of the last weird format.
Following ziglang#8007 and ziglang#8137 let's get rid of the last weird format.
Following ziglang#8007 and ziglang#8137 let's get rid of the last weird format.
Let's follow the road paved by the removal of 'z'/'Z', the Formatter
pattern is nice enough to let us remove the remaining four special cases
and declare u8 slices free from any special casing!