@@ -10,7 +10,10 @@ use rustc_span::{source_map::Span, sym, Symbol};
10
10
11
11
use if_chain:: if_chain;
12
12
13
- use crate :: utils:: { has_iter_method, is_trait_method, snippet_with_applicability, span_lint_and_then} ;
13
+ use clippy_utils:: diagnostics:: span_lint_and_then;
14
+ use clippy_utils:: is_trait_method;
15
+ use clippy_utils:: source:: snippet_with_applicability;
16
+ use clippy_utils:: ty:: has_iter_method;
14
17
15
18
declare_clippy_lint ! {
16
19
/// **What it does:** Checks for usage of `for_each` that would be more simply written as a
@@ -104,18 +107,12 @@ impl LateLintPass<'_> for NeedlessForEach {
104
107
snippet_with_applicability( cx, body. value. span, ".." , & mut applicability) ,
105
108
) ;
106
109
107
- span_lint_and_then(
108
- cx,
109
- NEEDLESS_FOR_EACH ,
110
- stmt. span,
111
- "needless use of `for_each`" ,
112
- |diag| {
113
- diag. span_suggestion( stmt. span, "try" , sugg, applicability) ;
114
- if let Some ( ret_suggs) = ret_suggs {
115
- diag. multipart_suggestion( "try replacing `return` with `continue`" , ret_suggs, applicability) ;
116
- }
110
+ span_lint_and_then( cx, NEEDLESS_FOR_EACH , stmt. span, "needless use of `for_each`" , |diag| {
111
+ diag. span_suggestion( stmt. span, "try" , sugg, applicability) ;
112
+ if let Some ( ret_suggs) = ret_suggs {
113
+ diag. multipart_suggestion( "...and replace `return` with `continue`" , ret_suggs, applicability) ;
117
114
}
118
- )
115
+ } )
119
116
}
120
117
}
121
118
}
0 commit comments