diff options
| author | dweiller <4678790+dweiller@users.noreplay.github.com> | 2023-05-02 22:08:54 +1000 |
|---|---|---|
| committer | dweiller <4678790+dweiller@users.noreplay.github.com> | 2023-05-07 15:55:21 +1000 |
| commit | bd3360e03d89fe947e3728ccacd4274653926376 (patch) | |
| tree | daf2107f394c94b41c55a6ecacd9f82ba145c1c4 /lib/std/json.zig | |
| parent | 2c5924c59a148335e5025b72a5ba98d765ed771d (diff) | |
| download | zig-bd3360e03d89fe947e3728ccacd4274653926376.tar.gz zig-bd3360e03d89fe947e3728ccacd4274653926376.zip | |
convert s[start..start+len] to s[start..][0..len]
Diffstat (limited to 'lib/std/json.zig')
| -rw-r--r-- | lib/std/json.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/json.zig b/lib/std/json.zig index af928bc564..011463faef 100644 --- a/lib/std/json.zig +++ b/lib/std/json.zig @@ -63,7 +63,7 @@ fn encodesTo(decoded: []const u8, encoded: []const u8) bool { var buf: [4]u8 = undefined; const len = std.unicode.utf8Encode(codepoint, &buf) catch unreachable; if (i + len > decoded.len) return false; - if (!mem.eql(u8, decoded[i .. i + len], buf[0..len])) return false; + if (!mem.eql(u8, decoded[i..][0..len], buf[0..len])) return false; i += len; } } @@ -2285,10 +2285,10 @@ pub fn encodeJsonStringChars(chars: []const u8, options: StringifyOptions, write const ulen = std.unicode.utf8ByteSequenceLength(chars[i]) catch unreachable; // control characters (only things left with 1 byte length) should always be printed as unicode escapes if (ulen == 1 or options.string.String.escape_unicode) { - const codepoint = std.unicode.utf8Decode(chars[i .. i + ulen]) catch unreachable; + const codepoint = std.unicode.utf8Decode(chars[i..][0..ulen]) catch unreachable; try outputUnicodeEscape(codepoint, writer); } else { - try writer.writeAll(chars[i .. i + ulen]); + try writer.writeAll(chars[i..][0..ulen]); } i += ulen - 1; }, |
