-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Lint collapsible_str_replace
#9269
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. |
fda1f5b
to
812db45
Compare
f48817f
to
363a01b
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.
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.
5c94de7
to
0829b31
Compare
0829b31
to
c9fba24
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.
Some more suggestiong on how to simplify the code. Thanks for addressing this so quickly!
c9fba24
to
4944935
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.
This review round, that comments are more about the tests. The code looks way cleaner and easier to understand now!
4944935
to
2533fd7
Compare
2533fd7
to
7639b77
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.
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. |
5f976f4
to
36694ad
Compare
36694ad
to
36cba51
Compare
36cba51
to
b070b40
Compare
@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