Conversation
|
☔ The latest upstream changes (presumably #4788) made this pull request unmergeable. Please resolve the merge conflicts. |
cf2fbb0 to
84c49ca
Compare
|
☔ The latest upstream changes (presumably #4697) made this pull request unmergeable. Please resolve the merge conflicts. |
84c49ca to
15720ae
Compare
|
☔ The latest upstream changes (presumably #4801) made this pull request unmergeable. Please resolve the merge conflicts. |
15720ae to
8254abb
Compare
|
☔ The latest upstream changes (presumably #4839) made this pull request unmergeable. Please resolve the merge conflicts. |
phansch
left a comment
There was a problem hiding this comment.
Apologies for having to wait so long for a review. I think this generally looks very good and I just found some small things to change.
| if let ExprKind::MethodCall(call_path, _, call_args) = &expr.kind; | ||
| if call_path.ident.as_str() == "ok_or_else"; | ||
| if let [receiver, closure_expr] = &**call_args; | ||
| if match_type(cx, cx.tables.expr_ty(receiver), &paths::OPTION); |
There was a problem hiding this comment.
| if match_type(cx, cx.tables.expr_ty(receiver), &paths::OPTION); | |
| if is_type_diagnostic_item(cx, cx.tables.expr_ty(receiver), sym!(option_type)); |
| if call_path.ident.as_str() == "map_err"; | ||
| if let [receiver, mapper_expr] = &**call_args; | ||
| let receiver_ty = cx.tables.expr_ty(receiver); | ||
| if match_type(cx, receiver_ty, &paths::RESULT); |
There was a problem hiding this comment.
| if match_type(cx, receiver_ty, &paths::RESULT); | |
| if is_type_diagnostic_item(cx, receiver_ty, sym!(result_type)); |
| let option = Some(3); | ||
| option.ok_or_else(|| String::from("foo"))?; | ||
| option.ok_or_else(|| String::from(complex_computation()))?; | ||
| // type arg not fixed |
There was a problem hiding this comment.
This looks like a leftover todo?
|
Thanks for contributing to Clippy! Sadly this PR was not updated in quite some time. If you waited on input from a reviewer, we're sorry that this fell under the radar. If you want to continue to work on this, just reopen the PR and/or ping a reviewer. |
changelog: New lint:
unneeded_try_convertchecks for things likeoption.unwrap_or_else(|| <..>::from(..))?as thefromis unneeded becase?will do it for you.Closes #4676
Some notes:
clippy::redundant_closurecatchesresult.map_err(|x| String::from(x))?and suggestsresult.map_err(String::from)?, which this then catches and suggestsresult?, but this also catchesresult.map_err(|x| String::from(x))?but instead suggestsresult.map_err(|x| x)?. I'm not sure whether we should add a special case specifically for that in this lint or maybe have another lint for uselessmapor if it's fine to just leave that as-is.