Conversation
There was a problem hiding this comment.
Pull request overview
This PR performs a search/highlight handler cleanup by extracting shared pattern-matching logic between RegexHandler and HighlightHandler into a new SearchState struct, and fixes two separate bugs: a bitwise-OR-instead-of-logical-OR bug in reader.rs, and a misnamed constructor Counter::mean() that should be Counter::mode().
Changes:
- Introduces
SearchStatein a newsearch.rsmodule to eliminate duplicated regex matching, match processing, and cleanup logic shared byRegexHandlerandHighlightHandler - Renames
Counter::mean()toCounter::mode()(and updates its call site) to correctly reflect the statistical operation being performed - Fixes a bug in
reader.rswhere bitwise OR (|) was used instead of logical OR (||) in a boolean condition
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/communication/handlers/search.rs |
New file introducing SearchState with shared search logic |
src/communication/handlers/regex.rs |
Refactored to compose SearchState instead of duplicating logic |
src/communication/handlers/highlight.rs |
Refactored to compose SearchState instead of duplicating logic |
src/communication/handlers/mod.rs |
Registers the new search module |
src/communication/reader.rs |
Fixes | (bitwise OR) to || (logical OR) in a boolean condition |
src/util/aggregators/counter.rs |
Renames mean() to mode() to accurately describe the constructor |
src/extensions/parser.rs |
Updates call site to use Counter::mode() |
The one issue found is an unused import in the new file:
The handler::Handler trait is imported in search.rs line 5 but is never used in that file — only update_progress and UserInputHandler from that same use statement are needed. This will produce an unused import compiler warning in Rust.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.