Skip to content

Conversation

@SOF3
Copy link
Owner

@SOF3 SOF3 commented Nov 1, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 1, 2025 04:34
@SOF3 SOF3 force-pushed the retain branch 3 times, most recently from 5ac28d5 to c9de981 Compare November 1, 2025 04:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds retain and extract_if methods to WordVec, along with comprehensive test coverage. These methods allow in-place filtering of vector elements with different semantics: retain keeps elements matching a predicate, while extract_if returns an iterator that extracts (removes and yields) matching elements.

  • Implements retain method that removes elements not matching a predicate
  • Implements extract_if method that returns an iterator extracting matching elements
  • Adds a new retain module with the core filtering logic and ExtractIf iterator

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
src/lib.rs Added public retain and extract_if API methods and imported the retain module
src/retain.rs New module implementing the Retain helper struct and ExtractIf iterator with memory-safe element manipulation
src/tests.rs Added comprehensive test suite covering empty, full, partial, panic, and early-drop scenarios for both methods
Comments suppressed due to low confidence (2)

src/lib.rs:1

  • The documentation references retain_mut, but this method does not exist in WordVec. The correct reference should be to retain. Change both occurrences of retain_mut to retain.
//! A [thin][thinvec] and [small][smallvec] vector

src/lib.rs:1

  • The 'Panics' section states 'If range is out of bounds', but extract_if does not accept a range parameter and cannot panic for this reason. This section should be removed.
//! A [thin][thinvec] and [small][smallvec] vector

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings November 1, 2025 04:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SOF3 SOF3 merged commit 8c22e7f into master Nov 2, 2025
17 checks passed
@SOF3 SOF3 deleted the retain branch November 2, 2025 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants