diff options
| author | Bhargav Srinivasan <bsvasan92@icloud.com> | 2020-09-22 03:50:28 -0700 |
|---|---|---|
| committer | Bhargav Srinivasan <bsvasan92@icloud.com> | 2020-09-22 03:50:28 -0700 |
| commit | 778bb4b324f4764386f55781d70e8167f1dd1abc (patch) | |
| tree | 157bdad436258e1e1792374582d41d697c819785 /lib/std | |
| parent | 983830a4ae9955f95b46a4fb64d3914468226ccb (diff) | |
| download | zig-778bb4b324f4764386f55781d70e8167f1dd1abc.tar.gz zig-778bb4b324f4764386f55781d70e8167f1dd1abc.zip | |
return not found error correctly
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/priority_queue.zig | 2 |
1 files changed, 1 insertions, 1 deletions
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; |
