aboutsummaryrefslogtreecommitdiff
path: root/lib/std/priority_queue.zig
diff options
context:
space:
mode:
authorZander Khan <git@zander.xyz>2021-01-16 18:43:13 +0000
committerZander Khan <git@zander.xyz>2021-01-16 18:43:13 +0000
commite1ab425bcead727a73e4512aeca1ba9112b2c88e (patch)
treea8ca372e937ab2d58f9aeba738fc77ad78437875 /lib/std/priority_queue.zig
parentc6986f29f94ee404ae3a3221449dc4af5599ca1f (diff)
downloadzig-e1ab425bcead727a73e4512aeca1ba9112b2c88e.tar.gz
zig-e1ab425bcead727a73e4512aeca1ba9112b2c88e.zip
Fix slice length when updating
Diffstat (limited to 'lib/std/priority_queue.zig')
-rw-r--r--lib/std/priority_queue.zig2
1 files changed, 1 insertions, 1 deletions
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)) {