From e73b56aa4bcb7e53144ef96ee978f2a19b32669d Mon Sep 17 00:00:00 2001 From: Jimmi Holst Christensen Date: Tue, 22 Oct 2024 17:46:47 +0200 Subject: refactor: Always access using full namespace This is my new preferred style of programming Zig :) --- clap/codepoint_counting_writer.zig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'clap/codepoint_counting_writer.zig') diff --git a/clap/codepoint_counting_writer.zig b/clap/codepoint_counting_writer.zig index e6b9d1c..c445c90 100644 --- a/clap/codepoint_counting_writer.zig +++ b/clap/codepoint_counting_writer.zig @@ -1,7 +1,3 @@ -const std = @import("std"); -const builtin = @import("builtin"); -const native_endian = builtin.cpu.arch.endian(); - /// A Writer that counts how many codepoints has been written to it. /// Expects valid UTF-8 input, and does not validate the input. pub fn CodepointCountingWriter(comptime WriterType: type) type { @@ -34,6 +30,7 @@ pub fn CodepointCountingWriter(comptime WriterType: type) type { // the number of codepoints up to that point. // Does not validate UTF-8 beyond checking the start byte. fn utf8CountCodepointsAllowTruncate(s: []const u8) !struct { bytes: usize, codepoints: usize } { + const native_endian = @import("builtin").cpu.arch.endian(); var len: usize = 0; const N = @sizeOf(usize); @@ -100,3 +97,5 @@ test "handles partial UTF-8 writes" { try testing.expectEqualSlices(u8, utf8_text, fbs.getWritten()); } + +const std = @import("std"); -- cgit v1.2.3