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

refactor(interpreter): consistency in all_results_are_covered() #961

Merged

Conversation

IaroslavMazur
Copy link
Contributor

While any of the 2 could've been used to achieve consistency, { } has been chosen because, as far as I've read, it doesn't lead to any memory being allocated (being just a code block), while ( ), representing the "unit type", does occupy some memory.

The latter isn't as important in the context of a test function, of course, but given that this would be the better option (over ( )), in general, don't see why it wouldn't also be used throughout the test functions (to maintain the consistency with the production codebase functions).

Curious about your take on this, @rakita

- export the return_error! macro to the crate level;
- unite the 2 redundant match arms when initializing SuccessOrHalt
  from from InstructionResult;
Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

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

() does not take any memory, it is just a compiler sugar. In rust everything is a expression if you put {} it will compile it as {()} so there is no change here.

This look nicer so lgtm

@rakita rakita merged commit 0b4c074 into bluealloy:main Jan 10, 2024
22 of 23 checks passed
@IaroslavMazur
Copy link
Contributor Author

() does not take any memory, it is just a compiler sugar. In rust everything is a expression if you put {} it will compile it as {()} so there is no change here.

Good to know, thank you for the insight! 🙏

@github-actions github-actions bot mentioned this pull request Jan 12, 2024
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.

None yet

2 participants