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

rename solidity_testing_smoke to solidity_testing_sanctuary #616

Merged
merged 2 commits into from
Oct 23, 2023

Conversation

OmarTawfik
Copy link
Contributor

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Oct 23, 2023

⚠️ No Changeset found

Latest commit: 332743c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

match self {
Self::SolidityTestingSanctuary => {
// This crate parses tens of thousands of Solidity files:
// It is worth spending the extra time to recompiling its dependenceis.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// It is worth spending the extra time to recompiling its dependenceis.
// It is worth spending the extra time to recompiling its dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch.

#[clap(name = "solidity_npm_build", hide = true)]
SolidityNpmBuild,
}

impl RunCommand {
fn should_run_in_release_mode(&self) -> bool {
match self {
Copy link
Contributor

Choose a reason for hiding this comment

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

optional style nit - I find that 'everything is an expression' in Rust helps simplify the code in many places, this could just be

match self {
   // This crate ...
   Self::SolidityTestingSanctuary => true,
   // These ...
   ... | ... => false,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't really like that return is optional in Rust. It is an important keyword in almost all programming languages that describe exactly whether the expression on the right hand side results in a value or ()/void. It is very useful when reading statements left to right to understand the context as the reader's eye is moving.

It is less of an issue in a tiny function like this, but in more complex ones, it is much more important, especially with multiple match cases or if branches.

If it is possible, I would have hoped to enforce it everywhere. Saving the few extra keystrokes is just not worth it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am going to 100% disagree here. Rust is an expression-oriented language, so eliding the return statement is quite natural. I prefer it unless there are early returns, which I don't like in any case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree, I'd have to go with the prevalent code style that's used in Rust. In complex code with early return it's needed to use the return statement but for majority of cases I find that eliding the statement is more natural. I would optimize for the more common case and for familiarity/ease of onboarding other Rust devs here.

We should enable and enforce Clippy at some point and call it a day 👍

#[clap(name = "solidity_cargo_build", hide = true)]
SolidityCargoBuild,

/// Runs codegen for the NAPI parser crate.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: The wording seems to imply that NAPI may somehow correspond equally to Rust but it's the "same" Rust parser crate, just with aux bindings/glue to NAPI. What do you think about clarifying this a little bit?

Suggested change
/// Runs codegen for the NAPI parser crate.
/// Runs codegen for the NAPI-exposed parser crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@OmarTawfik OmarTawfik marked this pull request as ready for review October 23, 2023 12:48
@OmarTawfik OmarTawfik requested a review from a team as a code owner October 23, 2023 12:48
@OmarTawfik OmarTawfik enabled auto-merge October 23, 2023 13:05
@OmarTawfik OmarTawfik added this pull request to the merge queue Oct 23, 2023
Merged via the queue into NomicFoundation:main with commit bb53987 Oct 23, 2023
1 check passed
@OmarTawfik OmarTawfik deleted the rename-smoke-tests branch October 23, 2023 13:36
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.

3 participants