1
1
use clippy_utils:: diagnostics:: span_lint_and_then;
2
2
use clippy_utils:: source:: snippet_with_context;
3
- use clippy_utils:: visitors:: { for_each_local_assignment, for_each_value_source, is_local_used } ;
3
+ use clippy_utils:: visitors:: { for_each_local_assignment, for_each_value_source} ;
4
4
use core:: ops:: ControlFlow ;
5
5
use rustc_errors:: Applicability ;
6
6
use rustc_hir:: def:: { DefKind , Res } ;
@@ -82,7 +82,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, local: &'tcx LetStmt<'_>) {
82
82
83
83
// If this is a binding pattern, we need to add suggestions to remove any usages
84
84
// of the variable
85
- if let PatKind :: Binding ( _, binding_hir_id, ident , ..) = local. pat . kind
85
+ if let PatKind :: Binding ( _, binding_hir_id, _ , ..) = local. pat . kind
86
86
&& let Some ( body_id) = cx. enclosing_body . as_ref ( )
87
87
{
88
88
let body = cx. tcx . hir ( ) . body ( * body_id) ;
@@ -92,7 +92,6 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, local: &'tcx LetStmt<'_>) {
92
92
walk_body ( & mut visitor, body) ;
93
93
94
94
// Add suggestions for replacing variable usages
95
- let has_usages = !visitor. spans . is_empty ( ) ;
96
95
suggestions. extend ( visitor. spans . into_iter ( ) . map ( |span| ( span, "()" . to_string ( ) ) ) ) ;
97
96
}
98
97
0 commit comments