Skip to content

Commit 5d6a100

Browse files
committed
format code
1 parent c3fde34 commit 5d6a100

File tree

1 file changed

+13
-13
lines changed
  • clippy_lints/src/methods

1 file changed

+13
-13
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,18 +1976,17 @@ fn lint_search_is_some<'a, 'tcx>(
19761976
let search_snippet = snippet(cx, search_args[1].span, "..");
19771977
if search_snippet.lines().count() <= 1 {
19781978
// suggest `any(|x| ..)` instead of `any(|&x| ..)` for `find(|&x| ..).is_some()`
1979-
let any_search_snippet =
1980-
if_chain! {
1981-
if search_method == "find";
1982-
if let hir::ExprKind::Closure(_, _, body_id, ..) = search_args[1].node;
1983-
let closure_body = cx.tcx.hir().body(body_id);
1984-
if let hir::PatKind::Ref(..) = closure_body.arguments[0].pat.node;
1985-
then {
1986-
Some(search_snippet.replacen('&', "", 1))
1987-
} else {
1988-
None
1989-
}
1990-
};
1979+
let any_search_snippet = if_chain! {
1980+
if search_method == "find";
1981+
if let hir::ExprKind::Closure(_, _, body_id, ..) = search_args[1].node;
1982+
let closure_body = cx.tcx.hir().body(body_id);
1983+
if let hir::PatKind::Ref(..) = closure_body.arguments[0].pat.node;
1984+
then {
1985+
Some(search_snippet.replacen('&', "", 1))
1986+
} else {
1987+
None
1988+
}
1989+
};
19911990
// add note if not multi-line
19921991
span_note_and_lint(
19931992
cx,
@@ -1997,7 +1996,8 @@ fn lint_search_is_some<'a, 'tcx>(
19971996
expr.span,
19981997
&format!(
19991998
"replace `{0}({1}).is_some()` with `any({2})`",
2000-
search_method, search_snippet,
1999+
search_method,
2000+
search_snippet,
20012001
any_search_snippet.as_ref().map_or(&*search_snippet, String::as_str)
20022002
),
20032003
);

0 commit comments

Comments
 (0)