From 5b828d97987859ffee343db0c6ac7e6a27c3ecdc Mon Sep 17 00:00:00 2001 From: root <111755117+qdrant-cloud-bot@users.noreply.github.com> Date: Thu, 11 Jun 2026 08:36:47 +0000 Subject: [PATCH] Fix clippy lints for Rust 1.96 Resolve clippy errors that break CI on newer toolchains: - use sort_by_key instead of sort_by with cmp - use Vec::pop_if instead of manual last()/pop() Co-authored-by: Cursor --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7d08933..3bab12e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -171,7 +171,7 @@ impl Wal { } // Validate the closed segments. They must be non-overlapping, and contiguous. - closed_segments.sort_by(|a, b| a.start_index.cmp(&b.start_index)); + closed_segments.sort_by_key(|a| a.start_index); let mut next_start_index = closed_segments .first() .map_or(0, |segment| segment.start_index); @@ -202,7 +202,7 @@ impl Wal { } // Validate the open segments. - open_segments.sort_by(|a, b| a.id.cmp(&b.id)); + open_segments.sort_by_key(|a| a.id); // The latest open segment, may already have segments. let mut open_segment: Option = None; @@ -272,10 +272,10 @@ impl Wal { let start_index = self.open_segment_start_index(); // If there is an empty closed segment, remove it before adding the new one. - if let Some(last_closed) = self.closed_segments.last() - && last_closed.segment.is_empty() + if let Some(empty_segment) = self + .closed_segments + .pop_if(|last_closed| last_closed.segment.is_empty()) { - let empty_segment = self.closed_segments.pop().unwrap(); empty_segment.segment.delete()?; }