Conversation
5ac28d5 to
c9de981
Compare
There was a problem hiding this comment.
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
retainmethod that removes elements not matching a predicate - Implements
extract_ifmethod that returns an iterator extracting matching elements - Adds a new
retainmodule with the core filtering logic andExtractIfiterator
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 inWordVec. The correct reference should be toretain. Change both occurrences ofretain_muttoretain.
//! A [thin][thinvec] and [small][smallvec] vector
src/lib.rs:1
- The 'Panics' section states 'If
rangeis out of bounds', butextract_ifdoes 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.
There was a problem hiding this comment.
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.
No description provided.