-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix question_mark
FP on custom error type
#7860
Conversation
r? @giraffate (rust-highfive has picked a reviewer for you, use r? to override) |
tests/ui/question_mark.rs
Outdated
let _ = if let Ok(x) = func_returning_result() { | ||
x | ||
} else { | ||
return Err("some error".to_string()); | ||
}; | ||
|
||
if func_returning_result().is_err() { | ||
return func_returning_result(); | ||
} |
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.
This should cover for #7859.
Sorry for the late reviewing. I can go back to reviewing in a few days. |
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.
Overall looks good, thanks!
I made small comments. I prefer to use expr
instead of expression
for naming, if there is no specific reason.
a6bbbb9
to
fb0fbad
Compare
Thanks for the review! Addressed the nits 🙂 |
@bors r+ Thanks! |
📌 Commit fb0fbad has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Closes #7859
#7840 aims to ignore
question_mark
when the return type is custom, which is covered here. But this fails when there is a call in conditional predicatechangelog: [
question_mark
] Fix false positive when there is call in conditional predicate