-
Notifications
You must be signed in to change notification settings - Fork 738
Title: Remove redundant allocation in bool_input #9504
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
base: main
Are you sure you want to change the base?
Conversation
orizi
left a comment
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.
@orizi made 1 comment.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @conomist).
crates/cairo-lang-test-utils/src/lib.rs line 124 at r1 (raw file):
_ if input.eq_ignore_ascii_case("false") => false, _ => panic!("Expected 'true' or 'false', actual: {input}"), }
Suggestion:
if input.eq_ignore_ascii_case("true") {
true
} else if input.eq_ignore_ascii_case("false") {
false
} else {
panic!("Expected 'true' or 'false', actual: {input}")
}
orizi
left a comment
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.
@orizi reviewed all commit messages and made 1 comment.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @conomist).
crates/cairo-lang-test-utils/src/lib.rs line 121 at r2 (raw file):
pub fn bool_input(input: &str) -> bool { match () { if input.eq_ignore_ascii_case("true") => true,
please fix.
orizi
left a comment
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.
@orizi made 1 comment.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @conomist).
crates/cairo-lang-test-utils/src/lib.rs line 121 at r2 (raw file):
Previously, orizi wrote…
please fix.
close PR if you don't plan on actually make the code compile and be well formatted.
Switch bool_input to use eq_ignore_ascii_case guards instead of lowercasing, eliminating per-call string allocation while keeping behavior unchanged