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 :) --- example/simple.zig | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'example/simple.zig') diff --git a/example/simple.zig b/example/simple.zig index a7207c7..7f1bfc0 100644 --- a/example/simple.zig +++ b/example/simple.zig @@ -1,9 +1,3 @@ -const clap = @import("clap"); -const std = @import("std"); - -const debug = std.debug; -const io = std.io; - pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); @@ -27,17 +21,20 @@ pub fn main() !void { .allocator = gpa.allocator(), }) catch |err| { // Report useful error and exit - diag.report(io.getStdErr().writer(), err) catch {}; + diag.report(std.io.getStdErr().writer(), err) catch {}; return err; }; defer res.deinit(); if (res.args.help != 0) - debug.print("--help\n", .{}); + std.debug.print("--help\n", .{}); if (res.args.number) |n| - debug.print("--number = {}\n", .{n}); + std.debug.print("--number = {}\n", .{n}); for (res.args.string) |s| - debug.print("--string = {s}\n", .{s}); + std.debug.print("--string = {s}\n", .{s}); for (res.positionals) |pos| - debug.print("{s}\n", .{pos}); + std.debug.print("{s}\n", .{pos}); } + +const clap = @import("clap"); +const std = @import("std"); -- cgit v1.2.3