Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: clean up unused code #349

Merged
merged 1 commit into from
Sep 27, 2024
Merged

internal: clean up unused code #349

merged 1 commit into from
Sep 27, 2024

Conversation

lijunchen
Copy link
Contributor

No description provided.

Copy link

peter-jerry-ye-code-review bot commented Sep 27, 2024

Observed Problems and Suggestions

  1. Redundant Imports and Functions in fmt.rs:

    • The function format_package and its helper walk_dir have been removed. These functions seem to be responsible for formatting MoonBit files using moonfmt. If the functionality is no longer needed, ensure that all related imports (e.g., std::path::{Path, PathBuf}, std::process::Command, anyhow::Context, moonutil::common::IGNORE_DIRS, walkdir::WalkDir) are also removed to avoid unused import warnings.
    • If the formatting functionality is being replaced or moved elsewhere, ensure that the new implementation addresses the same requirements and that no necessary functionality is lost.
  2. Unused Trait Implementations in mod.rs:

    • The PartialOrd and Ord trait implementations for MiAlias have been removed. If these comparisons are no longer needed, ensure that any code relying on sorting or ordering of MiAlias instances is updated accordingly. If sorting or comparison is still required, consider reimplementing these traits or ensure that an alternative approach is in place.
  3. Unused Functions and Imports in lib.rs:

    • The functions bail_moon_check_is_running and write_current_pid have been removed. Ensure that any calls to these functions in other parts of the codebase are also removed or updated. If these functions are part of a larger error-handling or process management workflow, ensure that there's a clear replacement or alternative strategy to handle the same scenarios.
    • The import std::io::Write is removed. Ensure that no other part of the codebase requires this import for writing to files or other I/O operations.

General Advice

  • Code Cleanup: The changes seem focused on removing unused code and imports. This is generally a good practice to reduce clutter and potential bugs. However, ensure that you're not removing code that's commented out for future reference or that might be needed based on future feature additions.
  • Review Dependencies: With the removal of several functions and imports, review the remaining imports to ensure they are all necessary. Unused imports can lead to build bloat and potential confusion during maintenance.
  • Testing: After making significant changes to the codebase, especially deletions, ensure thorough testing is conducted to verify that existing functionality remains intact and that any new functionality introduced does not conflict with the changes. Automated tests, where applicable, are particularly useful for this purpose.

These observations and suggestions should help maintain a clean and efficient codebase while ensuring that all necessary functionality remains intact.

@lijunchen lijunchen enabled auto-merge (squash) September 27, 2024 08:11
@lijunchen lijunchen merged commit 3045405 into main Sep 27, 2024
9 checks passed
@lijunchen lijunchen deleted the clean-up branch September 27, 2024 08:18
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