@@ -7,7 +7,7 @@ use rustc_ast::ast::RangeLimits;
7
7
use rustc_hir:: { Expr , ExprKind } ;
8
8
use rustc_lint:: { LateContext , LateLintPass } ;
9
9
use rustc_middle:: ty;
10
- use rustc_session:: { declare_lint_pass , declare_tool_lint } ;
10
+ use rustc_session:: { declare_tool_lint , impl_lint_pass } ;
11
11
12
12
declare_clippy_lint ! {
13
13
/// ### What it does
@@ -82,21 +82,19 @@ declare_clippy_lint! {
82
82
"indexing/slicing usage"
83
83
}
84
84
85
+ impl_lint_pass ! ( IndexingSlicing => [ INDEXING_SLICING , OUT_OF_BOUNDS_INDEXING ] ) ;
86
+
85
87
#[ derive( Copy , Clone ) ]
86
88
pub struct IndexingSlicing {
87
89
suppress_lint_in_const : bool ,
88
90
}
89
91
90
92
impl IndexingSlicing {
91
93
pub fn new ( suppress_lint_in_const : bool ) -> Self {
92
- Self {
93
- suppress_lint_in_const,
94
- }
94
+ Self { suppress_lint_in_const }
95
95
}
96
96
}
97
97
98
- declare_lint_pass ! ( IndexingSlicing => [ INDEXING_SLICING , OUT_OF_BOUNDS_INDEXING ] ) ;
99
-
100
98
impl < ' tcx > LateLintPass < ' tcx > for IndexingSlicing {
101
99
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) {
102
100
if self . suppress_lint_in_const && cx. tcx . hir ( ) . is_inside_const_context ( expr. hir_id ) {
@@ -204,7 +202,7 @@ fn to_const_range(cx: &LateContext<'_>, range: higher::Range<'_>, array_size: u1
204
202
} else {
205
203
Some ( x)
206
204
}
207
- }
205
+ } ,
208
206
Some ( _) => None ,
209
207
None => Some ( array_size) ,
210
208
} ;
0 commit comments