Commit bfc86776d5

Andrew Kelley <andrew@ziglang.org>
2019-05-30 00:55:42
run zig fmt to update `use` to `usingnamespace`
1 parent 8a4ee59
src-self-hosted/c.zig
@@ -1,4 +1,4 @@
-pub use @cImport({
+pub usingnamespace @cImport({
     @cDefine("__STDC_CONSTANT_MACROS", "");
     @cDefine("__STDC_LIMIT_MACROS", "");
     @cInclude("inttypes.h");
src-self-hosted/translate_c.zig
@@ -6,7 +6,7 @@ const builtin = @import("builtin");
 const assert = std.debug.assert;
 const ast = std.zig.ast;
 const Token = std.zig.Token;
-use @import("clang.zig");
+usingnamespace @import("clang.zig");
 
 pub const Mode = enum {
     import,
std/c/darwin.zig
@@ -3,7 +3,7 @@ const assert = std.debug.assert;
 const builtin = @import("builtin");
 const macho = std.macho;
 
-use @import("../os/bits.zig");
+usingnamespace @import("../os/bits.zig");
 
 extern "c" fn __error() *c_int;
 pub extern "c" fn _NSGetExecutablePath(buf: [*]u8, bufsize: *u32) c_int;
std/c/linux.zig
@@ -1,5 +1,5 @@
 const std = @import("../std.zig");
-use std.c;
+usingnamespace std.c;
 
 extern "c" fn __errno_location() *c_int;
 pub const _errno = __errno_location;
std/math/big.zig
@@ -1,5 +1,5 @@
-pub use @import("big/int.zig");
-pub use @import("big/rational.zig");
+pub usingnamespace @import("big/int.zig");
+pub usingnamespace @import("big/rational.zig");
 
 test "math.big" {
     _ = @import("big/int.zig");
std/os/bits/linux.zig
@@ -1,10 +1,10 @@
 const builtin = @import("builtin");
 const std = @import("../../std.zig");
 const maxInt = std.math.maxInt;
-use @import("../bits.zig");
+usingnamespace @import("../bits.zig");
 
-pub use @import("linux/errno.zig");
-pub use switch (builtin.arch) {
+pub usingnamespace @import("linux/errno.zig");
+pub usingnamespace switch (builtin.arch) {
     .x86_64 => @import("linux/x86_64.zig"),
     .aarch64 => @import("linux/arm64.zig"),
     else => struct {},
std/os/bits/windows.zig
@@ -1,6 +1,6 @@
 // The reference for these types and values is Microsoft Windows's ucrt (Universal C RunTime).
 
-use @import("../windows/bits.zig");
+usingnamespace @import("../windows/bits.zig");
 
 pub const fd_t = HANDLE;
 pub const pid_t = HANDLE;
std/os/linux/x86_64.zig
@@ -1,4 +1,4 @@
-use @import("../bits.zig");
+usingnamespace @import("../bits.zig");
 
 pub fn syscall0(number: usize) usize {
     return asm volatile ("syscall"
std/os/windows/advapi32.zig
@@ -1,4 +1,4 @@
-use @import("bits.zig");
+usingnamespace @import("bits.zig");
 
 pub extern "advapi32" stdcallcc fn RegOpenKeyExW(
     hKey: HKEY,
std/os/windows/kernel32.zig
@@ -1,4 +1,4 @@
-use @import("bits.zig");
+usingnamespace @import("bits.zig");
 
 pub extern "kernel32" stdcallcc fn CancelIoEx(hFile: HANDLE, lpOverlapped: LPOVERLAPPED) BOOL;
 
std/os/windows/ntdll.zig
@@ -1,3 +1,3 @@
-use @import("bits.zig");
+usingnamespace @import("bits.zig");
 
 pub extern "NtDll" stdcallcc fn RtlCaptureStackBackTrace(FramesToSkip: DWORD, FramesToCapture: DWORD, BackTrace: **c_void, BackTraceHash: ?*DWORD) WORD;
std/os/windows/ole32.zig
@@ -1,4 +1,4 @@
-use @import("bits.zig");
+usingnamespace @import("bits.zig");
 
 pub extern "ole32" stdcallcc fn CoTaskMemFree(pv: LPVOID) void;
 pub extern "ole32" stdcallcc fn CoUninitialize() void;
std/os/windows/shell32.zig
@@ -1,3 +1,3 @@
-use @import("bits.zig");
+usingnamespace @import("bits.zig");
 
 pub extern "shell32" stdcallcc fn SHGetKnownFolderPath(rfid: *const KNOWNFOLDERID, dwFlags: DWORD, hToken: ?HANDLE, ppszPath: *[*]WCHAR) HRESULT;
std/os/bits.zig
@@ -3,7 +3,7 @@
 
 const builtin = @import("builtin");
 
-pub use switch (builtin.os) {
+pub usingnamespace switch (builtin.os) {
     .macosx, .ios, .tvos, .watchos => @import("bits/darwin.zig"),
     .freebsd => @import("bits/freebsd.zig"),
     .linux => @import("bits/linux.zig"),
std/os/darwin.zig
@@ -4,4 +4,4 @@ pub const is_the_target = switch (builtin.os) {
     .macosx, .tvos, .watchos, .ios => true,
     else => false,
 };
-pub use std.c;
+pub usingnamespace std.c;
std/os/freebsd.zig
@@ -1,4 +1,4 @@
 const std = @import("../std.zig");
 const builtin = @import("builtin");
 pub const is_the_target = builtin.os == .freebsd;
-pub use std.c;
+pub usingnamespace std.c;
std/os/linux.zig
@@ -14,12 +14,12 @@ const vdso = @import("linux/vdso.zig");
 const dl = @import("../dynamic_library.zig");
 
 pub const is_the_target = builtin.os == .linux;
-pub use switch (builtin.arch) {
+pub usingnamespace switch (builtin.arch) {
     .x86_64 => @import("linux/x86_64.zig"),
     .aarch64 => @import("linux/arm64.zig"),
     else => struct {},
 };
-pub use @import("bits.zig");
+pub usingnamespace @import("bits.zig");
 pub const tls = @import("linux/tls.zig");
 
 /// Set by startup code, used by `getauxval`.
std/os/netbsd.zig
@@ -1,4 +1,4 @@
 const builtin = @import("builtin");
 const std = @import("../std.zig");
 pub const is_the_target = builtin.os == .netbsd;
-pub use std.c;
+pub usingnamespace std.c;
std/os/wasi.zig
@@ -5,7 +5,7 @@ const std = @import("std");
 const assert = std.debug.assert;
 
 pub const is_the_target = builtin.os == .wasi;
-pub use @import("bits.zig");
+pub usingnamespace @import("bits.zig");
 
 comptime {
     assert(@alignOf(i8) == 1);
std/os/windows.zig
@@ -18,7 +18,7 @@ pub const ntdll = @import("windows/ntdll.zig");
 pub const ole32 = @import("windows/ole32.zig");
 pub const shell32 = @import("windows/shell32.zig");
 
-pub use @import("windows/bits.zig");
+pub usingnamespace @import("windows/bits.zig");
 
 pub const CreateFileError = error{
     SharingViolation,
std/os/zen.zig
@@ -80,7 +80,7 @@ pub const STDOUT_FILENO = 1;
 pub const STDERR_FILENO = 2;
 
 // FIXME: let's borrow Linux's error numbers for now.
-use @import("bits/linux/errno.zig");
+usingnamespace @import("bits/linux/errno.zig");
 // Get the errno from a syscall return value, or 0 for no error.
 pub fn getErrno(r: usize) usize {
     const signed_r = @bitCast(isize, r);
std/c.zig
@@ -2,9 +2,9 @@ const builtin = @import("builtin");
 const std = @import("std");
 const page_size = std.mem.page_size;
 
-pub use @import("os/bits.zig");
+pub usingnamespace @import("os/bits.zig");
 
-pub use switch (builtin.os) {
+pub usingnamespace switch (builtin.os) {
     .linux => @import("c/linux.zig"),
     .windows => @import("c/windows.zig"),
     .macosx, .ios, .tvos, .watchos => @import("c/darwin.zig"),
std/os.zig
@@ -46,7 +46,7 @@ pub const system = if (builtin.link_libc) std.c else switch (builtin.os) {
     else => struct {},
 };
 
-pub use @import("os/bits.zig");
+pub usingnamespace @import("os/bits.zig");
 
 /// See also `getenv`. Populated by startup code before main().
 pub var environ: [][*]u8 = undefined;
test/stage1/behavior/bugs/1076.zig
@@ -13,4 +13,3 @@ fn testCastPtrOfArrayToSliceAndPtr() void {
     x[0] += 1;
     expect(mem.eql(u8, array[0..], "boeu"));
 }
-
test/stage1/behavior/bugs/1486.zig
@@ -8,4 +8,3 @@ test "constant pointer to global variable causes runtime load" {
     expect(&global == ptr);
     expect(ptr.* == 1234);
 }
-
test/stage1/behavior/bugs/421.zig
@@ -13,4 +13,3 @@ fn extractOne64(a: u128) u64 {
     const x = @bitCast([2]u64, a);
     return x[1];
 }
-
test/stage1/behavior/bugs/529.zig
@@ -12,4 +12,3 @@ test "issue 529 fixed" {
     @import("529_other_file.zig").issue529(null);
     issue529(null);
 }
-
test/stage1/behavior/bugs/726.zig
@@ -13,4 +13,3 @@ test "@ptrCast from var in empty struct to nullable" {
     var x: ?*const u8 = @ptrCast(?*const u8, &container.c);
     expect(x.?.* == 4);
 }
-
test/stage1/behavior/alignof.zig
@@ -15,4 +15,3 @@ test "@alignOf(T) before referencing T" {
         comptime expect(@alignOf(Foo) == 4);
     }
 }
-
test/stage1/behavior/fn.zig
@@ -205,4 +205,3 @@ test "extern struct with stdcallcc fn pointer" {
     s.ptr = S.foo;
     expect(s.ptr() == 1234);
 }
-
test/stage1/behavior/import.zig
@@ -12,7 +12,7 @@ test "importing the same thing gives the same import" {
 
 test "import in non-toplevel scope" {
     const S = struct {
-        use @import("import/a_namespace.zig");
+        usingnamespace @import("import/a_namespace.zig");
     };
     expectEqual(i32(1234), S.foo());
 }
test/stage1/behavior/popcount.zig
@@ -41,4 +41,3 @@ fn testPopCount() void {
         expect(@popCount(i128, 0b11111111000110001100010000100001000011000011100101010001) == 24);
     }
 }
-
test/stage1/behavior/reflection.zig
@@ -93,4 +93,3 @@ const Bar = union(enum) {
     Three: bool,
     Four: f64,
 };
-
test/stage1/behavior/struct.zig
@@ -552,7 +552,7 @@ test "packed struct with fp fields" {
 
 test "use within struct scope" {
     const S = struct {
-        use struct {
+        usingnamespace struct {
             pub fn inner() i32 {
                 return 42;
             }
test/stage1/behavior/this.zig
@@ -32,4 +32,3 @@ test "this refer to container" {
     expect(pt.x == 13);
     expect(pt.y == 35);
 }
-
test/stage1/behavior/undefined.zig
@@ -66,4 +66,3 @@ test "type name of undefined" {
     const x = undefined;
     expect(mem.eql(u8, @typeName(@typeOf(x)), "(undefined)"));
 }
-
test/stage1/behavior/union.zig
@@ -374,7 +374,7 @@ const Attribute = union(enum) {
 fn setAttribute(attr: Attribute) void {}
 
 fn Setter(attr: Attribute) type {
-    return struct{
+    return struct {
         fn set() void {
             setAttribute(attr);
         }
test/stage1/behavior/widening.zig
@@ -25,4 +25,3 @@ test "float widening" {
     var d: f128 = c;
     expect(d == a);
 }
-
test/standalone/use_alias/c.zig
@@ -1,1 +1,1 @@
-pub use @cImport(@cInclude("foo.h"));
+pub usingnamespace @cImport(@cInclude("foo.h"));