-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix FN in needless_return
#10110
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
Fix FN in needless_return
#10110
Conversation
r? @Alexendoo (rustbot has picked a reviewer for you, use r? to override) |
Hey @Niki4tap, I wasn't sure what you meant with the changelog entry. My guess is, that this changes makes sure that not borrowed values are now detected properly? I've updated the changelog entry accordingly. Did I get it right? 🙃 |
Yeah, that's probably it, sorry, not sure what I've meant there myself to be completely honest. I was thinking of something along the lines of "improving the |
No problem at all, I'm happy that you took the time to think about it and you also responded super quick! :) |
Oh, and, thanks for the correction ;) |
@@ -292,7 +295,7 @@ fn last_statement_borrows<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) | |||
{ | |||
ControlFlow::Break(()) | |||
} else { | |||
ControlFlow::Continue(Descend::from(!expr.span.from_expansion())) | |||
ControlFlow::Continue(Descend::from(!e.span.from_expansion())) |
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 missed this part and spent far too long wondering how the changes above this fixed the issue 😅
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.
Awwww, I made commits separate specifically for this :v
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.
Yeah thanks for that, I ended up spotting it because I did a git log
and saw the separate fix commit
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Fixes #10051
changelog: Enhancement: [
needless_return
]: Now detects more cases for returns of owned values#10110