From 55df9daaa0a4ea515e802f3985f162e2b2b54565 Mon Sep 17 00:00:00 2001 From: Tamo Date: Tue, 26 Mar 2024 19:34:55 +0100 Subject: [PATCH] adds a comment about the safety of an operation --- meilisearch/src/search_queue.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/meilisearch/src/search_queue.rs b/meilisearch/src/search_queue.rs index 9c0a6704a..b661fefb0 100644 --- a/meilisearch/src/search_queue.rs +++ b/meilisearch/src/search_queue.rs @@ -72,6 +72,7 @@ impl SearchQueue { _ = search_finished.recv() => { searches_running = searches_running.saturating_sub(1); if !queue.is_empty() { + // Can't panic: the queue wasn't empty thus the range isn't empty. let remove = rng.gen_range(0..queue.len()); let channel = queue.swap_remove(remove); let _ = channel.send(Permit { sender: sender.clone() });