@@ -1976,18 +1976,17 @@ fn lint_search_is_some<'a, 'tcx>(
1976
1976
let search_snippet = snippet ( cx, search_args[ 1 ] . span , ".." ) ;
1977
1977
if search_snippet. lines ( ) . count ( ) <= 1 {
1978
1978
// 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
+ } ;
1991
1990
// add note if not multi-line
1992
1991
span_note_and_lint (
1993
1992
cx,
@@ -1997,7 +1996,8 @@ fn lint_search_is_some<'a, 'tcx>(
1997
1996
expr. span ,
1998
1997
& format ! (
1999
1998
"replace `{0}({1}).is_some()` with `any({2})`" ,
2000
- search_method, search_snippet,
1999
+ search_method,
2000
+ search_snippet,
2001
2001
any_search_snippet. as_ref( ) . map_or( & * search_snippet, String :: as_str)
2002
2002
) ,
2003
2003
) ;
0 commit comments