Skip to content

cleanup: remove dead code and unnecessary allow(dead_code) annotations#46

Closed
echobt wants to merge 1 commit intomainfrom
cleanup/remove-dead-code
Closed

cleanup: remove dead code and unnecessary allow(dead_code) annotations#46
echobt wants to merge 1 commit intomainfrom
cleanup/remove-dead-code

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Feb 4, 2026

Summary

This PR cleans up #[allow(dead_code)] annotations in several modules. Dead code is either removed if truly unused, or the annotation is removed if the code is actually used.

Changes

  • cortex-app-server/src/storage.rs: Removed unused base_dir field from SessionStorage struct (the field was stored but never read after initialization)
  • cortex-mcp-client/src/transport.rs: Removed unused reconnect() methods from both StdioTransport and HttpTransport, along with the unused test_connection() method from HttpTransport. Also removed unused imports (tokio::time::sleep and tracing::error)
  • cortex-apply-patch/src/hunk.rs: Removed unused replace_all field and with_replace_all() method from SearchReplace struct (internal struct not exposed in public API)

Verification

cargo check -p cortex-app-server -p cortex-mcp-client -p cortex-apply-patch
cargo test -p cortex-app-server -p cortex-mcp-client -p cortex-apply-patch

@greptile-apps
Copy link

greptile-apps bot commented Feb 4, 2026

Greptile Overview

Greptile Summary

This PR removes dead code and unnecessary #[allow(dead_code)] annotations across three modules, resulting in cleaner, more maintainable code without any functional changes.

Changes:

  • storage.rs: removed base_dir field from SessionStorage that was stored during initialization but never accessed
  • transport.rs: removed reconnect() methods from both StdioTransport and HttpTransport that were never called, along with unused test_connection() helper and related imports
  • hunk.rs: removed replace_all field and with_replace_all() builder method from SearchReplace struct that were never utilized

All removed code was verified to be truly unused through codebase searches. The changes are purely cleanup with no impact on functionality.

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it only removes genuinely unused code
  • All changes were verified as truly dead code through codebase searches. No methods or fields being removed are referenced anywhere. The PR description accurately documents the changes and includes verification commands. This is pure cleanup with zero functional impact.
  • No files require special attention

Important Files Changed

Filename Overview
src/cortex-app-server/src/storage.rs Removed unused base_dir field from SessionStorage struct - field was only used during initialization and never read afterward
src/cortex-mcp-client/src/transport.rs Removed unused reconnect() methods from both transport implementations, unused test_connection() method, and unused imports (tokio::time::sleep, tracing::error)
src/cortex-apply-patch/src/hunk.rs Removed unused replace_all field and with_replace_all() method from internal SearchReplace struct - functionality was never implemented

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Compiler as Rust Compiler
    participant Code as Codebase
    
    Dev->>Code: Remove #[allow(dead_code)] annotations
    Dev->>Code: Delete unused struct fields
    Dev->>Code: Delete unused methods
    Dev->>Code: Remove unused imports
    
    Dev->>Compiler: cargo check
    Compiler->>Code: Analyze all packages
    Compiler-->>Dev: ✓ No dead_code warnings
    
    Dev->>Compiler: cargo test
    Compiler->>Code: Run tests for modified packages
    Compiler-->>Dev: ✓ All tests pass
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@echobt
Copy link
Contributor Author

echobt commented Feb 4, 2026

Closing as part of PR consolidation. This dead code cleanup has been consolidated into PR #77 (consolidated code quality improvements). See #77 for the comprehensive refactoring changes.

@echobt echobt closed this Feb 4, 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