-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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: remove a string matching about methods #99119
Refactor: remove a string matching about methods #99119
Conversation
r? @jackh726 (rust-highfive has picked a reviewer for you, use r? to override) |
24b0b0d
to
1599c5a
Compare
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.
Thanks @TaKO8Ki. Can we take this opportunity to simplify the code for this suggestion?
if receiver.ends_with(&method_call) { | ||
None // do not suggest code that is already there (#53348) | ||
let mut suggestions = iter::zip(iter::repeat(&expr), &methods) | ||
.filter_map(|(receiver_expr, method)| { |
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.
It may be simpler to bind receiver_expr
as a variable above and use it as the closure environment.
&& receiver_method.ident.name == sym::clone | ||
&& method_call_list.contains(&method_call.as_str()) | ||
{ | ||
vec![( |
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.
Could you add a comment to explain what is the purpose of this branch?
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.
Thanks, that is much clearer.
A couple more nits then r=me.
4a11f33
to
45b88af
Compare
Thanks ! |
Rollup of 5 pull requests Successful merges: - rust-lang#88991 (Add Nintendo Switch as tier 3 target) - rust-lang#98869 (Remove some usages of `guess_head_span`) - rust-lang#99119 (Refactor: remove a string matching about methods) - rust-lang#99209 (Correctly handle crate level page on docs.rs as well) - rust-lang#99246 (Update RLS) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This patch remove a string matching about methods and adds some rustfix tests.