fix(rust): remove unused import warnings across core domains#2019
Conversation
Resolves all compiler warnings generated during . Changes are grouped by fix type: **Remove unused symbols (dead code cleanup):** - channels/telegram/channel_send.rs: drop and — imported but never called - composio/providers/profile.rs: drop and — only referenced in the test submodule which imports them separately - learning/cache.rs: drop — re-exported as via full path, not needed as a bare binding - learning/stability_detector.rs: drop — only used in the cfg(test) block which has its own import - memory/store/factories.rs: drop — not referenced anywhere in the file - memory/tree/chat/mod.rs: drop — routing now uses Config booleans, not the enum directly - memory/tree/score/extract/mod.rs: drop — same as above - memory/tree/tree_source/source_file.rs: drop and — only used in tests which pull them via - skills/ops_create.rs: drop — leftover from the pre-QuickJS-removal code path **Gate cfg-specific import correctly:** - composio/trigger_history.rs: wrap in to match its sole usage site inside a block **Suppress intentional test-surface re-exports:** - channels/telegram/channel.rs: on the re-export that exists solely so the path module can resolve it via - tools/impl/browser/browser.rs: on the re-export used by Verified: now emits 0 of the 12 targeted warnings.
📝 WalkthroughWalkthroughThis PR performs systematic import cleanup across twelve modules in the openhuman codebase. Changes include adding compiler pragmas to suppress unused-import warnings, removing unused configuration and domain-model type imports, and aligning standard library imports with actual usage. No functional logic or public API signatures are altered. ChangesImport Cleanup and Dead Code Elimination
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Cleanup of Rust compiler warnings about unused imports across multiple core domains. The PR either drops the unused bindings, narrows the import set, or applies #[allow(unused_imports)] on items that exist solely as test-surface re-exports. One import is gated with #[cfg(windows)] to match its sole usage site.
Changes:
- Remove unused symbols from
usestatements in 9 files (channels, composio, learning, memory, skills). - Add
#[cfg(windows)]gating forstd::sync::Mutexincomposio/trigger_history.rs. - Suppress
unused_importson intentional#[path]-based test re-exports intelegram/channel.rsandbrowser/browser.rs.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/openhuman/tools/impl/browser/browser.rs | Adds #[allow(unused_imports)] on test-surface re-export. |
| src/openhuman/skills/ops_create.rs | Drops unused SkillFrontmatter from import list. |
| src/openhuman/memory/tree/tree_source/source_file.rs | Narrows import to just Tree; however TreeKind/TreeStatus are still referenced by the in-file test module. |
| src/openhuman/memory/tree/score/extract/mod.rs | Drops unused LlmBackend. |
| src/openhuman/memory/tree/chat/mod.rs | Drops unused LlmBackend (still referenced only in a comment). |
| src/openhuman/memory/store/factories.rs | Drops unused LocalAiConfig (only referenced in doc comments). |
| src/openhuman/learning/stability_detector.rs | Drops top-level Arc import; tests re-import it locally. |
| src/openhuman/learning/cache.rs | Drops FacetState bare binding (still re-exported by full path below). |
| src/openhuman/composio/trigger_history.rs | Gates Mutex import with #[cfg(windows)]. |
| src/openhuman/composio/providers/profile.rs | Drops unused FacetState/UserState. |
| src/openhuman/channels/providers/telegram/channel.rs | Adds #[allow(unused_imports)] on intentional re-export. |
| src/openhuman/channels/providers/telegram/channel_send.rs | Drops unused parse_attachment_markers and parse_path_only_attachment. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/openhuman/memory/tree/tree_source/source_file.rs`:
- Line 35: The test module fails because TreeKind and TreeStatus aren't exported
into the parent module scope; add imports for these test enums/types alongside
the existing Tree import so the test's use super::*; can access them —
specifically import TreeKind and TreeStatus (the symbols used in the tests) into
the module that contains the test (where Tree is imported) so lines referencing
TreeKind and TreeStatus compile.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7eee3d61-e043-477c-b052-e97a5abb756c
📒 Files selected for processing (12)
src/openhuman/channels/providers/telegram/channel.rssrc/openhuman/channels/providers/telegram/channel_send.rssrc/openhuman/composio/providers/profile.rssrc/openhuman/composio/trigger_history.rssrc/openhuman/learning/cache.rssrc/openhuman/learning/stability_detector.rssrc/openhuman/memory/store/factories.rssrc/openhuman/memory/tree/chat/mod.rssrc/openhuman/memory/tree/score/extract/mod.rssrc/openhuman/memory/tree/tree_source/source_file.rssrc/openhuman/skills/ops_create.rssrc/openhuman/tools/impl/browser/browser.rs
💤 Files with no reviewable changes (1)
- src/openhuman/learning/stability_detector.rs
Summary
unused_importscompiler warnings produced bycargo check --libacross 12 files in the Rust core.#[cfg(windows)], and suppressing intentional test-surface re-exports with#[allow(unused_imports)].Problem
cargo check --libproduced 12unused_importswarnings across core domains (channels,composio,learning,memory,skills,tools). These accumulated during the QuickJS runtime removal and subsequent refactors and create noise that obscures genuine new warnings during development.Solution
Three fix strategies applied:
parse_attachment_markers,parse_path_only_attachment,FacetState(×2),UserState,LlmBackend(×2),LocalAiConfig,TreeKind,TreeStatus,SkillFrontmatter,std::sync::Arc(instability_detector.rs— test-only).Mutexincomposio/trigger_history.rsmoved inside#[cfg(windows)]to match its sole usage site.#[allow(unused_imports)]onpub use TelegramChannel(exists forchannel_tests.rspath module) andpub(super) use backend_name(exists forbrowser_tests.rs). Removing these would break the test module import paths.Submission Checklist
## Related— N/A: no feature matrix entries affected.Closes #NNNin the## Relatedsection — N/A: no Linear issue; this is a maintainer-initiated cleanup PR.Impact
cargo check --libwarning count reduced from 12 (targeted) to 0 for theunused_importscategory.PermissionsExt,unused_mut,unused_variables,private_interfaces) are unchanged and in different files/modules; they are not in scope for this PR.Related
unused_imports,dead_code) inapp/src-tauri/can be addressed in a follow-up.AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
fix/rust-unused-import-warnings28299f0e669587360bae4d2e70cba73ed4873e42Validation Run
pnpm --filter openhuman-app format:check— passed (run by Husky pre-push hook)pnpm typecheck— passed (run by Husky pre-push hook, 0 errors)channel_tests.rs,browser_tests.rs) are covered by existing CI test runs.cargo check --lib→ 0 targeted warnings;cargo fmt --checkpassed (enforced by pre-push hook andType Check / Rust QualityCI job ✅).app/src-tauri/files modified.Validation Blocked
command:N/A — all local validation completed successfully.error:N/Aimpact:N/ABehavior Changes
Parity Contract
Duplicate / Superseded PR Handling