refactor: apply cargo clippy fixes to improve code quality#16
Merged
Conversation
d7b400a to
c157261
Compare
Applied clippy suggestions to improve code quality and maintainability, reducing warnings from 27 to 2. Changes: - Remove unused import: Manager from lib.rs - Replace sort_by with sort_by_key using Reverse for cleaner sorting - mobile_server.rs: session list sorting - agent/sessions.rs: session list sorting - Replace manual loop counter with enumerate() in llm/mod.rs - Collapse nested if let into single pattern match in book_travel.rs - Apply 20 automatic clippy fixes for: - Redundant return statements - Collapsible if statements - Iterator optimizations (replace .last() on DoubleEndedIterator) - Unnecessary borrows - Manual implementations of standard methods - Other idiomatic Rust patterns Remaining warnings (2): Two "too many arguments" warnings remain for functions that would require larger refactoring to use parameter structs: - call_background_llm (11 params) in agent/sessions.rs - emit_tool_event (9 params) in agent/mod.rs These are candidates for future refactoring but are deferred to avoid large changes affecting multiple call sites. Test results: - ✅ 186 Rust unit tests pass - ✅ TypeScript type check passes
c157261 to
afdc46f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Applied cargo clippy suggestions to improve code quality and maintainability, reducing warnings from 27 to 2.
Changes
Automatic Fixes (20 suggestions)
.last()onDoubleEndedIterator)Manual Fixes (7 suggestions)
Managerfromlib.rssort_bywithsort_by_keyfor cleaner sorting:enumerate():if letinto single pattern:Remaining Warnings (2)
Two "too many arguments" warnings remain for functions that would require larger refactoring:
call_background_llm(11 parameters) inagent/sessions.rsemit_tool_event(9 parameters) inagent/mod.rsThese functions are candidates for future refactoring using parameter structs, but are deferred to avoid large changes affecting multiple call sites in this PR.
Benefits
Test Plan