refactor(error/upgrade): move from the use of ref patterns to & and remove allow for lint ref_patterns - #4141
Open
logan-bobo wants to merge 10 commits into
Open
refactor(error/upgrade): move from the use of ref patterns to & and remove allow for lint ref_patterns#4141logan-bobo wants to merge 10 commits into
& and remove allow for lint ref_patterns#4141logan-bobo wants to merge 10 commits into
Conversation
ref_patterns& and remove allow for lint ref_patterns
logan-bobo
commented
Aug 4, 2026
Comment on lines
3564
to
3569
| /* | ||
| let r = self.thread.take().unwrap().join(); | ||
| if let Err(ref e) = r { | ||
| if let Err(e) = &r { | ||
| println!("{:?}", e); | ||
| } | ||
| r.unwrap(); |
Author
There was a problem hiding this comment.
I wonder if all of this code can be dropped?
logan-bobo
commented
Aug 4, 2026
Comment on lines
174
to
183
| pub(crate) fn as_ffi_mut(&mut self) -> &mut crate::ffi::UserBody { | ||
| match self.kind { | ||
| Kind::Ffi(ref mut body) => return body, | ||
| _ => { | ||
| self.kind = Kind::Ffi(crate::ffi::UserBody::new()); | ||
| } | ||
| if !matches!(self.kind, Kind::Ffi(_)) { | ||
| self.kind = Kind::Ffi(crate::ffi::UserBody::new()); | ||
| } | ||
|
|
||
| match self.kind { | ||
| Kind::Ffi(ref mut body) => body, | ||
| match &mut self.kind { | ||
| Kind::Ffi(body) => body, | ||
| _ => unreachable!(), | ||
| } | ||
| } |
Author
There was a problem hiding this comment.
I want to call this one out as the only place we could not do a straight ref -> & change.
The behaviour however is still the same.
- If the kind is ffi return a mutable reference to the body
- if the kind is not ffi set self.kind to
Kind::Ffi(crate::ffi::UserBody::new()) - After creating
Kind::Ffi(crate::ffi::UserBody::new())return as a mutable reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR aims to
allowforref_patternslint, that will now be caught by awarnonrestriction&References
progresses #4071