Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add lint
ref_mut_iter_method_chain
#7688Add lint
ref_mut_iter_method_chain
#7688Changes from all commits
6b48c3a
6aa878c
c959d5e
453c07b
31dc4ab
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
should work here.
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.
Isn't this the same as what
sugg::Sugg
does? Also I think the enumExprPosition
is pretty similar to theExprPrecedence
enum of rustc.Would using the
Sugg
utility also work here? If not, do you think it would be better to expand theSugg
utility, rather than implementing this new utils function?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.
Adding to the left or right of an operator needs to do different things.
1+1
added to the left of a subtraction doesn't need parenthesis, but added to the right it does.ExprPrecedence
doesn't allow that distinction.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.
Sugg
currently doesn't allow adding parenthesis based on where the will be inserted. I'm in the middle of reworkingSugg
now, but it's going to be a larger change to fit this in nicely.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.
Hm, I prefer reusing
Sugg
here anyway. If there are unnecessary parenthesis, rustc will warn on that afterwards. As long as the suggestion is semantically correct, I don't mind if there are a pair of parenthesis too many.Especially when you're working on
Sugg
anyway, I don't want to include a half-baked solution now. (Also big thanks for improving all of our utilities and not only the lints ❤️)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.
Working on #7986 which should be a nicer solution. We can hold off merging this until that's done.
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.
Yes, let's do this. 👍