Skip to content

Commit 7580e39

Browse files
committedJun 12, 2018
zig fmt
·
0.15.20.3.0
1 parent 3dd9af9 commit 7580e39

File tree

4 files changed

+23
-18
lines changed

4 files changed

+23
-18
lines changed
 

‎std/os/file.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub const File = struct {
9696
return File{ .handle = handle };
9797
}
9898

99-
pub const AccessError = error {
99+
pub const AccessError = error{
100100
PermissionDenied,
101101
NotFound,
102102
NameTooLong,

‎std/os/index.zig‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path:
734734
}
735735
}
736736

737-
pub const DeleteFileError = error {
737+
pub const DeleteFileError = error{
738738
FileNotFound,
739739
AccessDenied,
740740
FileBusy,
@@ -1035,7 +1035,7 @@ pub fn makePath(allocator: *Allocator, full_path: []const u8) !void {
10351035
}
10361036
}
10371037

1038-
pub const DeleteDirError = error {
1038+
pub const DeleteDirError = error{
10391039
AccessDenied,
10401040
FileBusy,
10411041
SymLinkLoop,
@@ -1090,7 +1090,6 @@ pub fn deleteDir(allocator: *Allocator, dir_path: []const u8) DeleteDirError!voi
10901090
},
10911091
else => @compileError("unimplemented"),
10921092
}
1093-
10941093
}
10951094

10961095
/// Whether ::full_path describes a symlink, file, or directory, this function
@@ -1227,7 +1226,7 @@ pub const Dir = struct {
12271226
};
12281227
};
12291228

1230-
pub const OpenError = error {
1229+
pub const OpenError = error{
12311230
PathNotFound,
12321231
NotDir,
12331232
AccessDenied,
@@ -1253,13 +1252,13 @@ pub const Dir = struct {
12531252
Os.windows => blk: {
12541253
var find_file_data: windows.WIN32_FIND_DATAA = undefined;
12551254
const handle = try windows_util.windowsFindFirstFile(allocator, dir_path, &find_file_data);
1256-
break :blk Handle {
1255+
break :blk Handle{
12571256
.handle = handle,
12581257
.find_file_data = find_file_data, // TODO guaranteed copy elision
12591258
.first = true,
12601259
};
12611260
},
1262-
Os.macosx, Os.ios => Handle {
1261+
Os.macosx, Os.ios => Handle{
12631262
.fd = try posixOpen(
12641263
allocator,
12651264
dir_path,
@@ -1271,8 +1270,13 @@ pub const Dir = struct {
12711270
.end_index = 0,
12721271
.buf = []u8{},
12731272
},
1274-
Os.linux => Handle {
1275-
.fd = try posixOpen(allocator, dir_path, posix.O_RDONLY | posix.O_DIRECTORY | posix.O_CLOEXEC, 0,),
1273+
Os.linux => Handle{
1274+
.fd = try posixOpen(
1275+
allocator,
1276+
dir_path,
1277+
posix.O_RDONLY | posix.O_DIRECTORY | posix.O_CLOEXEC,
1278+
0,
1279+
),
12761280
.index = 0,
12771281
.end_index = 0,
12781282
.buf = []u8{},
@@ -1378,7 +1382,7 @@ pub const Dir = struct {
13781382
if (attrs & windows.FILE_ATTRIBUTE_NORMAL != 0) break :blk Entry.Kind.File;
13791383
break :blk Entry.Kind.Unknown;
13801384
};
1381-
return Entry {
1385+
return Entry{
13821386
.name = name,
13831387
.kind = kind,
13841388
};

‎std/os/time.zig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn milliTimestampWindows() u64 {
7474
const epoch_adj = epoch.windows * ms_per_s;
7575

7676
const ft64 = (u64(ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
77-
return @divFloor(ft64, hns_per_ms) - - epoch_adj;
77+
return @divFloor(ft64, hns_per_ms) - -epoch_adj;
7878
}
7979

8080
fn milliTimestampDarwin() u64 {

‎std/os/windows/util.zig‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,11 +171,12 @@ test "InvalidDll" {
171171
};
172172
}
173173

174-
175-
pub fn windowsFindFirstFile(allocator: *mem.Allocator, dir_path: []const u8,
176-
find_file_data: *windows.WIN32_FIND_DATAA) !windows.HANDLE
177-
{
178-
const wild_and_null = []u8{'\\', '*', 0};
174+
pub fn windowsFindFirstFile(
175+
allocator: *mem.Allocator,
176+
dir_path: []const u8,
177+
find_file_data: *windows.WIN32_FIND_DATAA,
178+
) !windows.HANDLE {
179+
const wild_and_null = []u8{ '\\', '*', 0 };
179180
const path_with_wild_and_null = try allocator.alloc(u8, dir_path.len + wild_and_null.len);
180181
defer allocator.free(path_with_wild_and_null);
181182

@@ -195,7 +196,7 @@ pub fn windowsFindFirstFile(allocator: *mem.Allocator, dir_path: []const u8,
195196
}
196197

197198
return handle;
198-
}
199+
}
199200

200201
/// Returns `true` if there was another file, `false` otherwise.
201202
pub fn windowsFindNextFile(handle: windows.HANDLE, find_file_data: *windows.WIN32_FIND_DATAA) !bool {
@@ -207,4 +208,4 @@ pub fn windowsFindNextFile(handle: windows.HANDLE, find_file_data: *windows.WIN3
207208
};
208209
}
209210
return true;
210-
}
211+
}

0 commit comments

Comments
 (0)
Please sign in to comment.