diff options
| author | wooster0 <wooster0@proton.me> | 2025-05-11 17:38:16 +0900 |
|---|---|---|
| committer | Alex Rønne Petersen <alex@alexrp.com> | 2025-05-13 07:28:41 +0200 |
| commit | a365971a337116dd23df2b1bc86468d54885b4b2 (patch) | |
| tree | 070dfe739796151d4d1256a3cedd83989609be42 /src/Package/Fetch/git.zig | |
| parent | a3693aae3a9417c4298788af570762945b21ccba (diff) | |
| download | zig-a365971a337116dd23df2b1bc86468d54885b4b2.tar.gz zig-a365971a337116dd23df2b1bc86468d54885b4b2.zip | |
std.meta.intToEnum -> std.enums.fromInt
Also use an optional as the return type instead of an error code.
Diffstat (limited to 'src/Package/Fetch/git.zig')
| -rw-r--r-- | src/Package/Fetch/git.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Package/Fetch/git.zig b/src/Package/Fetch/git.zig index d74e83d8c3..de3912041f 100644 --- a/src/Package/Fetch/git.zig +++ b/src/Package/Fetch/git.zig @@ -313,7 +313,7 @@ pub const Repository = struct { unused: u3, type: u4, } = @bitCast(std.fmt.parseUnsigned(u16, iterator.data[iterator.pos..mode_end], 8) catch return error.InvalidTree); - const @"type" = std.meta.intToEnum(Entry.Type, mode.type) catch return error.InvalidTree; + const @"type" = std.enums.fromInt(Entry.Type, mode.type) orelse return error.InvalidTree; const executable = switch (mode.permission) { 0 => if (@"type" == .file) return error.InvalidTree else false, 0o644 => if (@"type" != .file) return error.InvalidTree else false, @@ -1144,7 +1144,7 @@ const EntryHeader = union(Type) { const rest_len = if (initial.has_next) try readSizeVarInt(reader) else 0; var uncompressed_length: u64 = initial.len; uncompressed_length |= std.math.shlExact(u64, rest_len, 4) catch return error.InvalidFormat; - const @"type" = std.meta.intToEnum(EntryHeader.Type, initial.type) catch return error.InvalidFormat; + const @"type" = std.enums.fromInt(EntryHeader.Type, initial.type) orelse return error.InvalidFormat; return switch (@"type") { inline .commit, .tree, .blob, .tag => |tag| @unionInit(EntryHeader, @tagName(tag), .{ .uncompressed_length = uncompressed_length, |
