Closed Young-Flash closed 1 week ago
Potential Unwrap of Result without Handling Errors:
crates/moon/src/cli/version.rs
, the use of ?
on moonc_version
and moonrun_version
suggests that these are Result
types. However, the original code did not handle potential errors, which could lead to runtime crashes if the versions cannot be retrieved.println!("moonc {}", moonc_version?);
Inconsistent Error Handling:
crates/moonutil/src/common.rs
, the functions get_moonc_version
and get_moonrun_version
were modified to return anyhow::Result<String>
, yet in other parts of the code, such as crates/moonutil/src/dirs.rs
, these functions are called without handling the potential errors.moonc_version: get_moonc_version().unwrap(),
Duplicate Print Statements:
crates/moon/src/cli/version.rs
, there are duplicate print statements for moonc
, which might be a typo or indicate a mistake in the logic.println!("moonc {}", moonc_version?);
println!("moonc {}", moonrun_version?);
These lines are repeated in the code block under different conditions, which might not be intended.
close https://github.com/moonbitlang/moon/issues/250 and add error handling for get version (https://github.com/moonbitlang/moon/issues/241)