fix(lint): resolve pre-existing strict clippy violations across 9 files [urgent]#2482
fix(lint): resolve pre-existing strict clippy violations across 9 files [urgent]#2482maxtongwang wants to merge 1 commit intozeroclaw-labs:mainfrom
Conversation
PR intake checks found warnings (non-blocking)Fast safe checks found advisory issues. CI lint/test/build gates still enforce merge quality.
Action items:
Detected Linear keys: none Run logs: https://github.com/zeroclaw-labs/zeroclaw/actions/runs/22704920701 Detected blocking line issues (sample):
Detected advisory line issues (sample):
|
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Pattern matching & XML event handling src/channels/ack_reaction.rs, src/tools/channel_ack_config.rs, src/tools/pptx_read.rs |
Simplified match patterns: replaced iteration-based equality check with contains, merged None/empty/direct arms, and combined Start/Empty XML event arms. |
Timestamp & rate-limit clamping src/channels/github.rs |
Safer timestamp conversion via u64::try_from(...).unwrap_or(0) and replaced manual min/max retry bounds with clamp(1, 60). |
Logging / control-flow tweak src/channels/telegram.rs, src/hooks/runner.rs |
Moved success log into the success branch for command registration; relocated warning emission after capability check for tool-result cancellation. |
Websocket message handling src/channels/napcat.rs |
Treats Binary, Pong, and Frame messages as unified no-ops in the listen loop (consolidated match arms). |
Test scaffolding & docs src/channels/mod.rs |
Removed duplicated per-test AutonomyConfig/ApprovalManager setup and dropped unused AutonomyLevel import; added doc comment to handle_confirm_tool_approval_side_effects. |
Formatting / literals src/tools/cron_add.rs |
Numeric literal formatted from 300000 to 300_000 (no semantic change). |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- feat(telegram): register bot commands with setMyCommands on startup #1695: Adjusts logging/control flow inside
TelegramChannel::register_commands, touching the same function modified here.
Suggested labels
ci
Suggested reviewers
- chumyin
- theonlyhennygod
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 78.95% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title clearly and specifically identifies the main change: resolving strict clippy violations across multiple files, which is the primary objective of the PR. |
| Description check | ✅ Passed | The description comprehensively covers all required sections: summary with clear objectives, change metadata with specific lint rules fixed, validation evidence, security/privacy/compatibility assessments, and rollback plan. |
| Linked Issues check | ✅ Passed | The PR successfully addresses both linked issues (#2442 and #2443): fixes formatting violations across files and removes unused approval_manager bindings from test functions in src/channels/mod.rs. |
| Out of Scope Changes check | ✅ Passed | All changes are strictly lint-focused and within scope. The PR fixes specific clippy violations, explicitly skips architectural issues (large_futures, excessive_bools) for separate refactoring, and contains no unrelated modifications. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
Comment @coderabbitai help to get the list of available commands and usage tips.
theonlyhennygod
left a comment
There was a problem hiding this comment.
Blocking merge for now: this PR is currently in a merge-conflict state with main (DIRTY/CONFLICTING). Please rebase or resolve conflicts against main, then I can re-review and merge while preserving contributor attribution.
…es [urgent] Fixes strict lint issues shown as pre-existing debt in the strict delta gate, reducing noise for every future PR and unblocking CI throughput. Changes by lint rule: - clippy::redundant_else: src/hooks/runner.rs - clippy::unnested_or_patterns: src/tools/channel_ack_config.rs, src/tools/pptx_read.rs (x2) - clippy::unreadable_literal: src/channels/napcat.rs, src/tools/cron_add.rs (x2) - clippy::manual_contains: src/channels/ack_reaction.rs - clippy::if_not_else: src/channels/telegram.rs - clippy::match_same_arms: src/channels/napcat.rs - clippy::manual_clamp: src/channels/github.rs (x2) - clippy::cast_sign_loss: src/channels/github.rs - unused_variables (approval_manager x5): src/channels/mod.rs - clippy::doc_lazy_continuation: src/channels/mod.rs - unused import (AutonomyLevel): src/channels/mod.rs Skipped architectural issues (large_futures, excessive_bools) as those require broader refactor scoped separately. Closes #2442 Closes #2443
5d26504 to
92d1b33
Compare
|
Closing — no longer needed. |
Summary
rust_strict_delta_gate.sh, which slows down every PR by adding noise to delta reportsLabel Snapshot
domain:code-qualitychoresize: Srisk: lowChange Metadata
src/hooks/runner.rsclippy::redundant_elsesrc/tools/channel_ack_config.rsclippy::unnested_or_patternssrc/tools/pptx_read.rsclippy::unnested_or_patterns(×2)src/channels/napcat.rsclippy::unreadable_literal,clippy::match_same_armssrc/tools/cron_add.rsclippy::unreadable_literal(×2)src/channels/ack_reaction.rsclippy::manual_containssrc/channels/telegram.rsclippy::if_not_elsesrc/channels/github.rsclippy::manual_clamp(×2),clippy::cast_sign_losssrc/channels/mod.rsunused_variables(×5 test fns),clippy::doc_lazy_continuation, unused importAutonomyLevelLinked Issue
Closes #2442
Closes #2443
Validation Evidence
cargo fmt --all -- --check→ passesclippy::cast_sign_lossin github.rs fixed viau64::try_from(...).unwrap_or(0)(safe:.max(0)guarantees non-negative before conversion)clippy::if_not_elsein telegram.rs: logic preserved, just condition and branches swappedunused_variables: 5 test functions createdapproval_managerfromautonomy_cfgbut the struct usedmock_price_approved_manager()instead — both dead bindings removedSecurity Impact
None. All changes are style/lint fixes in test and non-security paths.
Privacy and Data Hygiene
No personal data, secrets, or sensitive identifiers introduced.
Compatibility
No behavioral changes. All fixes are mechanical lint transformations.
i18n Follow-Through
Not applicable (Rust code only, no docs/i18n changes).
Human Verification
cargo fmt --all -- --checkstill passesSide Effects
Removes 5 unused
let autonomy_cfg+let approval_managerbindings from test functions insrc/channels/mod.rs. These were dead code — the struct initializers already calledmock_price_approved_manager().Agent Notes
Note: contributor is an external contributor (no Linear key assigned).
Rollback Plan
git revert 5d265040— clean revert, no structural changes.Risks
None. All changes are lint-only with no runtime impact.
Summary by CodeRabbit
Bug Fixes & Improvements
Refactor