btree/rangemap: CamelCase the error names

This commit is contained in:
Eugene Rossokha
2025-03-24 14:39:58 +02:00
parent 4511e36ae5
commit aa2743b05f
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -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;
}
}
+1 -1
View File
@@ -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");
}