Commit 778bb4b324

Bhargav Srinivasan <bsvasan92@icloud.com>
2020-09-22 12:50:28
return not found error correctly
1 parent 983830a
Changed files (1)
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;