From 84e05bb89b5a323f8bbf224efce5e95f8939684a Mon Sep 17 00:00:00 2001 From: Eugene Rossokha Date: Mon, 24 Mar 2025 14:39:58 +0200 Subject: [PATCH] btree/rangemap: CamelCase the error names --- src/util/btree.zig | 6 +++--- src/util/rangemap.zig | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/btree.zig b/src/util/btree.zig index 887b43f..e00f0b8 100644 --- a/src/util/btree.zig +++ b/src/util/btree.zig @@ -16,7 +16,7 @@ pub fn BTree(comptime N: type, comptime compare_fn: CompareFn(N), comptime deini gpa: Allocator, root: ?*Node = null, - pub const Error = error{ already_exists, does_not_exist } || Allocator.Error; + pub const Error = error{ AlreadyExists, DoesNotExist } || Allocator.Error; pub fn WalkFn(comptime C: type) type { return fn (*const Node, C) void; @@ -94,7 +94,7 @@ pub fn BTree(comptime N: type, comptime compare_fn: CompareFn(N), comptime deini child.parent = n; n.left = child; }, - .eq => return error.already_exists, + .eq => return error.AlreadyExists, } return .{ n, inserted }; } else { @@ -161,7 +161,7 @@ pub fn BTree(comptime N: type, comptime compare_fn: CompareFn(N), comptime deini } return node; } else { - return error.does_not_exist; + return error.DoesNotExist; } } diff --git a/src/util/rangemap.zig b/src/util/rangemap.zig index b661db8..809e805 100644 --- a/src/util/rangemap.zig +++ b/src/util/rangemap.zig @@ -210,7 +210,7 @@ test "Range map insertion" { _ = try map.insert(0, 10, "Range 1"); _ = try map.insert(20, 10, "Range 3"); - try std.testing.expectError(error.already_exists, map.insert(5, 10, "Invalid range")); + try std.testing.expectError(error.AlreadyExists, map.insert(5, 10, "Invalid range")); _ = try map.insert(1000, 10, "Range 4"); }