authorgravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-20 22:20:38+01:00
committergravatar for mail@linusgroh.deLinus Groh <mail@linusgroh.de> 2023-05-25 20:17:07+01:00
log9123377cdbd56b5b5e4062b69c8033abf6b5b93a
treed789d9902b215b12e4dd540897d94b6498938b7b
parent7860cd734ce1227b3e96e4829de8929d546f78e8

std.fmt: Rename parseWithSign() sign parameter enum values to snake case


1 files changed, 7 insertions(+), 7 deletions(-)

lib/std/fmt.zig+7-7
...@@ -1742,9 +1742,9 @@ pub fn Formatter(comptime format_fn: anytype) type {...@@ -1742,9 +1742,9 @@ pub fn Formatter(comptime format_fn: anytype) type {
1742/// See also `parseUnsigned`.1742/// See also `parseUnsigned`.
1743pub fn parseInt(comptime T: type, buf: []const u8, radix: u8) ParseIntError!T {1743pub fn parseInt(comptime T: type, buf: []const u8, radix: u8) ParseIntError!T {
1744 if (buf.len == 0) return error.InvalidCharacter;1744 if (buf.len == 0) return error.InvalidCharacter;
1745 if (buf[0] == '+') return parseWithSign(T, buf[1..], radix, .Pos);1745 if (buf[0] == '+') return parseWithSign(T, buf[1..], radix, .pos);
1746 if (buf[0] == '-') return parseWithSign(T, buf[1..], radix, .Neg);1746 if (buf[0] == '-') return parseWithSign(T, buf[1..], radix, .neg);
1747 return parseWithSign(T, buf, radix, .Pos);1747 return parseWithSign(T, buf, radix, .pos);
1748}1748}
17491749
1750test "parseInt" {1750test "parseInt" {
...@@ -1805,7 +1805,7 @@ fn parseWithSign(...@@ -1805,7 +1805,7 @@ fn parseWithSign(
1805 comptime T: type,1805 comptime T: type,
1806 buf: []const u8,1806 buf: []const u8,
1807 radix: u8,1807 radix: u8,
1808 comptime sign: enum { Pos, Neg },1808 comptime sign: enum { pos, neg },
1809) ParseIntError!T {1809) ParseIntError!T {
1810 if (buf.len == 0) return error.InvalidCharacter;1810 if (buf.len == 0) return error.InvalidCharacter;
18111811
...@@ -1835,8 +1835,8 @@ fn parseWithSign(...@@ -1835,8 +1835,8 @@ fn parseWithSign(
1835 }1835 }
18361836
1837 const add = switch (sign) {1837 const add = switch (sign) {
1838 .Pos => math.add,1838 .pos => math.add,
1839 .Neg => math.sub,1839 .neg => math.sub,
1840 };1840 };
18411841
1842 var x: T = 0;1842 var x: T = 0;
...@@ -1866,7 +1866,7 @@ fn parseWithSign(...@@ -1866,7 +1866,7 @@ fn parseWithSign(
1866/// Ignores '_' character in `buf`.1866/// Ignores '_' character in `buf`.
1867/// See also `parseInt`.1867/// See also `parseInt`.
1868pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) ParseIntError!T {1868pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) ParseIntError!T {
1869 return parseWithSign(T, buf, radix, .Pos);1869 return parseWithSign(T, buf, radix, .pos);
1870}1870}
18711871
1872test "parseUnsigned" {1872test "parseUnsigned" {