Skip to content

Resolve all Clippy warnings for idiomatic Rust#51

Merged
dak2 merged 1 commit into
mainfrom
fix-clippy-warnings
Mar 8, 2026
Merged

Resolve all Clippy warnings for idiomatic Rust#51
dak2 merged 1 commit into
mainfrom
fix-clippy-warnings

Conversation

@dak2

@dak2 dak2 commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Phase 1: Add Default trait impls for ChangeSet, LocalEnv, ScopeManager; remove redundant let binding in rbs/loader.rs
  • Phase 2: Remove all blanket #[allow(dead_code)] annotations across 10 files, confirming all annotated code is actually used
  • Phase 3: Fix API-level warnings — &Box<dyn BoxTrait>&dyn BoxTrait (double indirection), bundle 9-param function into MethodCallContext struct (too_many_arguments), replace redundant closure with function pointer, &PathBuf&Path

Test plan

  • cd rust && cargo test --lib — all existing tests pass
  • cd rust && cargo clippy --lib --all-features -- -W clippy::all — zero warnings
  • New unit tests: test_local_env_default, test_scope_manager_default, test_change_set_default

🤖 Generated with Claude Code

Clippy warnings indicate deviations from Rust idioms and best practices.
Resolving them improves code quality, prevents subtle bugs (e.g., double
indirection via &Box<dyn Trait>), and keeps the codebase maintainable as
it grows.

Changes by category:

Phase 1 - Mechanical fixes:
- Add Default trait impls for ChangeSet, LocalEnv, ScopeManager
- Remove redundant let binding in rbs/loader.rs (clippy::let_and_return)

Phase 2 - Remove #[allow(dead_code)] annotations:
- Remove blanket #[allow(dead_code)] from all structs, enums, traits,
  and impl blocks across 10 files (types.rs, scope.rs, box.rs, etc.)

Phase 3 - API refinements:
- Change BoxManager::get() return from &Box<dyn BoxTrait> to &dyn BoxTrait
  to eliminate unnecessary double indirection (clippy::borrowed_box)
- Bundle 9 parameters of process_method_call_common into MethodCallContext
  struct to fix clippy::too_many_arguments
- Replace redundant closure with function pointer in LspService::new
  (clippy::redundant_closure)
- Change &PathBuf to &Path in CLI command signatures
  (clippy::ptr_arg)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@dak2 dak2 merged commit 0df290b into main Mar 8, 2026
2 checks passed
@dak2 dak2 deleted the fix-clippy-warnings branch March 8, 2026 07:47
@dak2 dak2 mentioned this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant