moonbitlang / moon

The build system and package manager for MoonBit
https://moonbitlang.github.io/moon/
GNU Affero General Public License v3.0
187 stars 17 forks source link

fix watch event kind for windows #450

Closed Young-Flash closed 2 weeks ago

Young-Flash commented 2 weeks ago

close https://github.com/moonbitlang/moon/issues/422

peter-jerry-ye-code-review[bot] commented 2 weeks ago

From the provided git diff output, here are three potential issues or improvements that could be made in the watch.rs file:

  1. Unused Imports:

    • The lines -use notify::event::ModifyKind; and -use notify::event::ModifyKind; indicate that the ModifyKind import is no longer used in the code. This can be removed to avoid unnecessary imports and reduce clutter.
  2. Redundant Variable Assignment:

    • The lines - let (source_dir, target_dir) = (&moonbuild_opt.source_dir, &moonbuild_opt.target_dir); were removed. It seems that these variables were not necessary and the direct use of moonbuild_opt.source_dir and moonbuild_opt.target_dir simplifies the code. This change is likely an improvement to reduce redundancy.
  3. Large Code Block Refactoring:

    • The large block of code handling file modifications and updates (if event.paths.iter().all(|p| { ... }) was refactored into a separate function handle_file_change. This refactoring improves code readability and maintainability by breaking down the large block into a smaller, more focused function.

In summary, the changes suggest a cleanup of unused imports, removal of redundant variable assignments, and a refactoring to improve code readability. These are positive steps towards maintaining a cleaner and more efficient codebase.