mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-28 15:41:10 +00:00
Apply suggestions from code review
Co-authored-by: Samuel Tardieu <sam@rfc1149.net> Co-authored-by: Catherine Flores <catherine.3.flores@gmail.com>
This commit is contained in:
parent
22ba7925d6
commit
fb4f6035da
1 changed files with 3 additions and 12 deletions
|
@ -166,10 +166,9 @@ fn try_get_option_occurrence<'tcx>(
|
||||||
|
|
||||||
let mut app = Applicability::Unspecified;
|
let mut app = Applicability::Unspecified;
|
||||||
|
|
||||||
let (none_body, is_argless_call) = if let Some(call_expr) = try_get_argless_call_expr(none_body) {
|
let (none_body, is_argless_call) = match none_body.kind {
|
||||||
(call_expr, true)
|
ExprKind::Call(call_expr, []) if !none_body.span.from_expansion() => (call_expr, true),
|
||||||
} else {
|
_ => (none_body, false),
|
||||||
(none_body, false)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return Some(OptionOccurrence {
|
return Some(OptionOccurrence {
|
||||||
|
@ -195,14 +194,6 @@ fn try_get_option_occurrence<'tcx>(
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the call expr iff it does not have any args and was not from macro expansion.
|
|
||||||
fn try_get_argless_call_expr<'tcx>(expr: &Expr<'tcx>) -> Option<&'tcx Expr<'tcx>> {
|
|
||||||
match expr.kind {
|
|
||||||
ExprKind::Call(call_expr, []) if !expr.span.from_expansion() => Some(call_expr),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn try_get_inner_pat_and_is_result<'tcx>(cx: &LateContext<'tcx>, pat: &Pat<'tcx>) -> Option<(&'tcx Pat<'tcx>, bool)> {
|
fn try_get_inner_pat_and_is_result<'tcx>(cx: &LateContext<'tcx>, pat: &Pat<'tcx>) -> Option<(&'tcx Pat<'tcx>, bool)> {
|
||||||
if let PatKind::TupleStruct(ref qpath, [inner_pat], ..) = pat.kind {
|
if let PatKind::TupleStruct(ref qpath, [inner_pat], ..) = pat.kind {
|
||||||
let res = cx.qpath_res(qpath, pat.hir_id);
|
let res = cx.qpath_res(qpath, pat.hir_id);
|
||||||
|
|
Loading…
Reference in a new issue