aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-09-21 21:36:17 +0200
committerLemonBoy <thatlemon@gmail.com>2020-11-05 16:10:34 +0100
commit3a1f515e09902eeaafce0d1cd03c8472af6eacd0 (patch)
tree1b577eb5f63fb37c2c7929db9b26c7da1a31e6f4 /lib/std
parent1982e0c18a5d46a86ca411661a4d25039eb269e7 (diff)
downloadzig-3a1f515e09902eeaafce0d1cd03c8472af6eacd0.tar.gz
zig-3a1f515e09902eeaafce0d1cd03c8472af6eacd0.zip
Address review comments
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/fmt.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
index 238fc0595d..b98a9c4840 100644
--- a/lib/std/fmt.zig
+++ b/lib/std/fmt.zig
@@ -561,7 +561,7 @@ pub fn formatIntValue(
if (@typeInfo(@TypeOf(int_value)).Int.bits <= 21) {
return formatUnicodeCodepoint(@as(u21, int_value), options, writer);
} else {
- @compileError("Cannot print integer that is larger than 32 bits as an UTF-8 sequence");
+ @compileError("Cannot print integer that is larger than 21 bits as an UTF-8 sequence");
}
} else if (comptime std.mem.eql(u8, fmt, "b")) {
radix = 2;
@@ -657,7 +657,7 @@ pub fn formatUnicodeCodepoint(
if (unicode.utf8ValidCodepoint(c)) {
var buf: [4]u8 = undefined;
// The codepoint is surely valid, hence the use of unreachable
- const len = std.unicode.utf8Encode(@truncate(u21, c), &buf) catch |err| switch (err) {
+ const len = std.unicode.utf8Encode(c, &buf) catch |err| switch (err) {
error.Utf8CannotEncodeSurrogateHalf, error.CodepointTooLarge => unreachable,
};
return formatBuf(buf[0..len], options, writer);