-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Lint collapsible_str_replace
#9269
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
Conversation
r? @flip1995 (rust-highfive has picked a reviewer for you, use r? to override) |
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.
Only one comment about the test, otherwise the tests LGTM.
This could be included in the methods
module. Then you already get the method matching for free. You'll also have to check the type of the receiver and check if it is a string-ish (&str
, String
, ...) type. I think we have a helper for this(?).
☔ The latest upstream changes (presumably #9264) made this pull request unmergeable. Please resolve the merge conflicts. |
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.
This implementation is way too complicated. You walk the method chain way too often with for_each_expr
. You should walk it once and then return a vector of expressions to all the method calls, that you then reuse for all other checks you want to do.
I left multiple suggestions on how to simplify the code. Just comment if the suggestions are unclear or you have questions about them.
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.
Some more suggestiong on how to simplify the code. Thanks for addressing this so quickly!
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.
This review round, that comments are more about the tests. The code looks way cleaner and easier to understand now!
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.
Linting logic LGTM now. If the 2 test suggestions pass, this is ready to get merged.
☔ The latest upstream changes (presumably #8957) made this pull request unmergeable. Please resolve the merge conflicts. |
@bors r+ Thanks! That implementation turned out nicely! |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fixes #6651
If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.
.stderr
file)cargo test
passes locallycargo dev update_lints
cargo dev fmt