diff --git a/lib/std/priority_dequeue.zig b/lib/std/priority_dequeue.zig index 0d789bbdc8..9655458890 100644 --- a/lib/std/priority_dequeue.zig +++ b/lib/std/priority_dequeue.zig @@ -389,7 +389,7 @@ pub fn PriorityDequeue(comptime T: type) type { } pub fn update(self: *Self, elem: T, new_elem: T) !void { - var old_index: usize = std.mem.indexOfScalar(T, self.items[0 .. self.len - 1], elem) orelse return error.ElementNotFound; + var old_index: usize = std.mem.indexOfScalar(T, self.items[0..self.len], elem) orelse return error.ElementNotFound; _ = self.removeIndex(old_index); self.addUnchecked(new_elem); } diff --git a/lib/std/priority_queue.zig b/lib/std/priority_queue.zig index 6e286f1cea..dc3070d1b3 100644 --- a/lib/std/priority_queue.zig +++ b/lib/std/priority_queue.zig @@ -199,7 +199,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[0 .. self.len - 1], elem) orelse return error.ElementNotFound; + var update_index: usize = std.mem.indexOfScalar(T, self.items[0..self.len], elem) orelse return error.ElementNotFound; const old_elem: T = self.items[update_index]; self.items[update_index] = new_elem; if (self.compareFn(new_elem, old_elem)) {