[unnecessary_find_map]: look for then_some
This commit is contained in:
parent
29730969b1
commit
008746cae4
3 changed files with 21 additions and 1 deletions
|
|
@ -77,6 +77,16 @@ fn check_expression<'tcx>(cx: &LateContext<'tcx>, arg_id: hir::HirId, expr: &'tc
|
|||
}
|
||||
(true, true)
|
||||
},
|
||||
hir::ExprKind::MethodCall(segment, recv, [arg], _) => {
|
||||
if segment.ident.name == sym!(then_some)
|
||||
&& cx.typeck_results().expr_ty(recv).is_bool()
|
||||
&& path_to_local_id(arg, arg_id)
|
||||
{
|
||||
(false, true)
|
||||
} else {
|
||||
(true, true)
|
||||
}
|
||||
},
|
||||
hir::ExprKind::Block(block, _) => block
|
||||
.expr
|
||||
.as_ref()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue