manual_option_as_slice: ignore by-reference bindings - #17560
Conversation
|
Thanks for the pull request. A reviewer will take a look after it receives 2 community reviews. In the meantime, we would highly appreciate if you could try to review any of PRs waiting on community reviews. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
e430fce to
470c5b2
Compare
|
@blyxyas Would you mind taking a look at this when you have a chance? This fixes an incorrect suggestion in manual_option_as_slice. Thanks! |
Yes, |
|
(make sure to remember to squash+force push your commits 😉) |
7e7591d to
22a1665
Compare
Squshed. |
This comment has been minimized.
This comment has been minimized.
22a1665 to
0c3622a
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
Resolved the merge conflicts. @CommanderStorm Please review it again. |
|
no need. my review is already an +1. |
changelog: [
manual_option_as_slice]: avoid incorrect suggestions for by-referenceSomebindingsextract_ident_from_some_patpreviously ignored the effective binding mode of the innerSomepattern.For
Some(ref value)matched againstoption.as_ref(),valuehas an additional reference layer. As a result,slice::from_ref(value)can produce a&[&T], while the suggestedoption.as_slice()produces a&[T]. Applying the machine-applicable suggestion can therefore cause a type error.Check the binding mode computed by type checking and only lint by-value bindings. Add regression tests for
refandref mutbindings.