Skip to content

Commit d063516

Browse files
committed
check closure arguments before use it
1 parent 5d6a100 commit d063516

File tree

1 file changed

+2
-1
lines changed
  • clippy_lints/src/methods

1 file changed

+2
-1
lines changed

clippy_lints/src/methods/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1980,7 +1980,8 @@ fn lint_search_is_some<'a, 'tcx>(
19801980
if search_method == "find";
19811981
if let hir::ExprKind::Closure(_, _, body_id, ..) = search_args[1].node;
19821982
let closure_body = cx.tcx.hir().body(body_id);
1983-
if let hir::PatKind::Ref(..) = closure_body.arguments[0].pat.node;
1983+
if let Some(closure_arg) = closure_body.arguments.get(0);
1984+
if let hir::PatKind::Ref(..) = closure_arg.pat.node;
19841985
then {
19851986
Some(search_snippet.replacen('&', "", 1))
19861987
} else {

0 commit comments

Comments
 (0)