-
Notifications
You must be signed in to change notification settings - Fork 467
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
Eliminate unnecessary .typ()
call from keys_with_input_keys
#30878
base: main
Are you sure you want to change the base?
Conversation
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!
input_keys | ||
.next() | ||
.unwrap() | ||
.clone() |
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.
Rather than .clone()
ing up front, you can put a .cloned()
at the very end, so we only copy the ones we want to keep.
.clone() |
&& base_projection.get(*c) | ||
== Some(c) | ||
}) | ||
}), |
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.
}), | |
}) | |
.cloned(), |
That's the whole point of
keys_with_input_keys
that we already have the input key available, so we don't need to call.typ()
to get the key of an input. So, this PR substitutes thetyp
call withinput_keys.next().unwrap()
(which is a pattern that already occurs several times inkeys_with_input_keys
).Motivation
Tips for reviewer
Checklist
$T ⇔ Proto$T
mapping (possibly in a backwards-incompatible way), then it is tagged with aT-proto
label.