-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Improve map_entry
suggestion
#6937
Conversation
r? @Manishearth (rust-highfive has picked a reviewer for you, use r? to override) |
08d4f34
to
c6feb9b
Compare
@giraffate Woudl you like to review this PR? No worries if you can't. |
@Manishearth Yes, I'll do it. ( I think it will take a couple of days until first review, since the diff is so large. ) |
Totally fair, and feel free to pass it back to me if you need r? @giraffate |
✌️ @giraffate can now approve this pull request |
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.
@Jarcho Sorry, I'm just starting to read the code and still in the middle of review, but I made some comments.
f36a1fd
to
e3cd56a
Compare
☔ The latest upstream changes (presumably #6971) 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.
Sorry, I'm in the middle of review, but I made some review on this.
2458362
to
0bfc9c9
Compare
☔ The latest upstream changes (presumably #6931) made this pull request unmergeable. Please resolve the merge conflicts. |
0bfc9c9
to
9ac6111
Compare
☔ The latest upstream changes (presumably #7043) made this pull request unmergeable. Please resolve the merge conflicts. |
9ac6111
to
de18142
Compare
☔ The latest upstream changes (presumably #7047) made this pull request unmergeable. Please resolve the merge conflicts. |
@Jarcho I'm still reviewing this and will finish in the next 24 hours. |
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.
I looked through the changes and left some comments, but it takes more time to finish the review.
Btw, I ran lintcheck
, this lint was triggered only 1 time and that seemed like true-positive:+1:
@Y-Nak Thanks for your review! Nice catches! |
762651b
to
a0c4eca
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.
I finished the review and added some comments.
@giraffate Could you have a final look?
ff78dd4
to
12e96e8
Compare
Fix false positives where the map is used before inserting into the map. Fix false positives where two insertions happen. Suggest using `if let Entry::Vacant(e) = _.entry(_)` when `or_insert` might be a semantic change
Lint `if _.[!]contains_key(&_) { .. } else { .. }` so long as one of the branches contains an insertion.
Suggest using `or_insert_with` when possible
12e96e8
to
bcf3488
Compare
No worries. It's a big change. |
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 looks good to me, thanks for your work!
@bors r+ |
📌 Commit bcf3488 has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fixes: #5176
fixes: #4674
fixes: #4664
fixes: #1450
Still need to handle the value returned by
insert
correctly.changelog: Improve
map_entry
suggestion. Will now suggestor_insert
,insert_with
ormatch _.entry(_)
as appopriate.changelog: Fix
map_entry
false positives where the entry api can't be used. e.g. when the map is used for multiple things.