Fix redundant_closure false positive
This commit is contained in:
parent
28b0437354
commit
9d5e9cfd97
2 changed files with 7 additions and 2 deletions
|
|
@ -45,6 +45,7 @@ fn check_closure(cx: &LateContext, expr: &Expr) {
|
|||
// || {foo(); bar()}; can't be reduced here
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(ref ex) = blk.expr {
|
||||
if let ExprCall(ref caller, ref args) = ex.node {
|
||||
if args.len() != decl.inputs.len() {
|
||||
|
|
@ -52,8 +53,8 @@ fn check_closure(cx: &LateContext, expr: &Expr) {
|
|||
// is no way the closure is the same as the function
|
||||
return;
|
||||
}
|
||||
if args.iter().any(|arg| is_adjusted(cx, arg)) {
|
||||
// Are the arguments type-adjusted? Then we need the closure
|
||||
if is_adjusted(cx, ex) || args.iter().any(|arg| is_adjusted(cx, arg)) {
|
||||
// Are the expression or the arguments type-adjusted? Then we need the closure
|
||||
return;
|
||||
}
|
||||
let fn_ty = cx.tcx.expr_ty(caller);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue