From 778bb4b324f4764386f55781d70e8167f1dd1abc Mon Sep 17 00:00:00 2001 From: Bhargav Srinivasan Date: Tue, 22 Sep 2020 03:50:28 -0700 Subject: return not found error correctly --- lib/std/priority_queue.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/std/priority_queue.zig b/lib/std/priority_queue.zig index 02188b5564..2769e7aa02 100644 --- a/lib/std/priority_queue.zig +++ b/lib/std/priority_queue.zig @@ -195,7 +195,7 @@ pub fn PriorityQueue(comptime T: type) type { } pub fn update(self: *Self, elem: T, new_elem: T) !void { - var update_index: usize = std.mem.indexOfScalar(T, self.items, elem) catch |error| return error.ElementNotFound; + var update_index: usize = std.mem.indexOfScalar(T, self.items, elem) orelse return error.ElementNotFound; assert (update_index >= 0 and update_index < self.items.len); const old_elem: T = self.items[update_index]; self.items[update_index] = new_elem; -- cgit v1.2.3