@@ -7,7 +7,7 @@ use rustc_ast::ast::RangeLimits;
77use rustc_hir:: { Expr , ExprKind } ;
88use rustc_lint:: { LateContext , LateLintPass } ;
99use rustc_middle:: ty;
10- use rustc_session:: { declare_lint_pass , declare_tool_lint } ;
10+ use rustc_session:: { declare_tool_lint , impl_lint_pass } ;
1111
1212declare_clippy_lint ! {
1313 /// ### What it does
@@ -82,21 +82,19 @@ declare_clippy_lint! {
8282 "indexing/slicing usage"
8383}
8484
85+ impl_lint_pass ! ( IndexingSlicing => [ INDEXING_SLICING , OUT_OF_BOUNDS_INDEXING ] ) ;
86+
8587#[ derive( Copy , Clone ) ]
8688pub struct IndexingSlicing {
8789 suppress_lint_in_const : bool ,
8890}
8991
9092impl IndexingSlicing {
9193 pub fn new ( suppress_lint_in_const : bool ) -> Self {
92- Self {
93- suppress_lint_in_const,
94- }
94+ Self { suppress_lint_in_const }
9595 }
9696}
9797
98- declare_lint_pass ! ( IndexingSlicing => [ INDEXING_SLICING , OUT_OF_BOUNDS_INDEXING ] ) ;
99-
10098impl < ' tcx > LateLintPass < ' tcx > for IndexingSlicing {
10199 fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) {
102100 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
204202 } else {
205203 Some ( x)
206204 }
207- }
205+ } ,
208206 Some ( _) => None ,
209207 None => Some ( array_size) ,
210208 } ;
0 commit comments