-
Notifications
You must be signed in to change notification settings - Fork 659
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(primitives): improve readability of Env.validate_tx() #924
refactor(primitives): improve readability of Env.validate_tx() #924
Conversation
Would not merge this, the compiler is good enough to optimize it and not touching variables is a uncommon path. |
Didn't know the compiler is looking for ways to make such optimizations, as well. Good to know! However, I believe that the proposed changes increase code readability. |
Would agree with readability, I would even remove the temp variable and use functions directly. |
Should I, then, reopen the PR, removing the temporary variables? |
whatever is easier for you, if you want to do it in this PR just edit the title |
83f51f1
to
4e4ce0d
Compare
Done 🤝 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
The optimization comes from the fact that the respective variables are only created if they're, actually, going to be used after that (instead of being untouched due to an early return).