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

feat: impl Show for Failure #1364

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

feat: impl Show for Failure #1364

wants to merge 5 commits into from

Conversation

Lampese
Copy link
Collaborator

@Lampese Lampese commented Dec 25, 2024

No description provided.

Copy link

peter-jerry-ye-code-review bot commented Dec 25, 2024

‼️ This code review is generated by a bot. Please verify the content before trusting it.

Here are three observations from the provided git diff output:

  1. Inconsistent Implementation of Show for Failure:

    • In builtin.mbti, the impl Show for Failure is added, but the actual implementation is missing in that file. Instead, the implementation is provided in show.mbt. This could lead to confusion or errors if someone expects the implementation to be in builtin.mbti. It would be better to either move the implementation to builtin.mbti or ensure that the implementation in show.mbt is properly referenced.
  2. Potential Redundancy in Show Implementation:

    • The Show implementation for Failure in show.mbt includes both to_string and output methods. While this is not necessarily a bug, it might be redundant if the output method simply calls to_string and then logs the result. If this is the case, consider simplifying the code by having output directly use to_string internally.
  3. String Interpolation Syntax:

    • The string interpolation syntax \{msg} in the Failure implementation might be incorrect or non-standard depending on the language's syntax rules. Ensure that the correct syntax is used for string interpolation (e.g., {msg} or ${msg} depending on the language). If \{msg} is intentional, it should be documented to avoid confusion.

These observations should be reviewed to ensure code clarity, correctness, and maintainability.

@coveralls
Copy link
Collaborator

coveralls commented Dec 25, 2024

Pull Request Test Coverage Report for Build 4322

Details

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.01%) to 83.372%

Changes Missing Coverage Covered Lines Changed/Added Lines %
builtin/show.mbt 0 2 0.0%
Totals Coverage Status
Change from base Build 4321: -0.01%
Covered Lines: 4623
Relevant Lines: 5545

💛 - Coveralls

@Lampese Lampese linked an issue Dec 25, 2024 that may be closed by this pull request
@peter-jerry-ye
Copy link
Collaborator

Should we include the name of the constructor?

@@ -136,6 +136,18 @@ pub impl Show for String with output(self, logger) {
///|
pub impl Show for String with to_string(self) { self }

///|
pub impl Show for Failure with to_string(self) {
let Failure(msg) = self
Copy link
Contributor

Choose a reason for hiding this comment

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

to_string has a default implementation, this is not needed

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.

impl Show for Failure
4 participants