@@ -87,11 +87,8 @@ const SEGMENTS_MSG: &str = "segments should be composed of at least 1 element";
87
87
88
88
impl < ' tcx > LateLintPass < ' tcx > for UseSelf {
89
89
fn check_item ( & mut self , _cx : & LateContext < ' _ > , item : & Item < ' _ > ) {
90
- if !is_item_interesting ( item) {
91
- // This does two things:
92
- // 1) Reduce needless churn on `self.stack`
93
- // 2) Don't push `StackItem::NoCheck` when entering `ItemKind::OpaqueTy`,
94
- // in order to lint `foo() -> impl <..>`
90
+ if matches ! ( item. kind, ItemKind :: OpaqueTy ( _) ) {
91
+ // skip over `ItemKind::OpaqueTy` in order to lint `foo() -> impl <..>`
95
92
return ;
96
93
}
97
94
// We push the self types of `impl`s on a stack here. Only the top type on the stack is
@@ -119,7 +116,7 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
119
116
}
120
117
121
118
fn check_item_post ( & mut self , _: & LateContext < ' _ > , item : & Item < ' _ > ) {
122
- if is_item_interesting ( item) {
119
+ if ! matches ! ( item. kind , ItemKind :: OpaqueTy ( _ ) ) {
123
120
self . stack . pop ( ) ;
124
121
}
125
122
}
@@ -297,11 +294,3 @@ fn lint_path_to_variant(cx: &LateContext<'_>, path: &Path<'_>) {
297
294
span_lint ( cx, span) ;
298
295
}
299
296
}
300
-
301
- fn is_item_interesting ( item : & Item < ' _ > ) -> bool {
302
- use rustc_hir:: ItemKind :: { Const , Enum , Fn , Impl , Static , Struct , Trait , Union } ;
303
- matches ! (
304
- item. kind,
305
- Impl { .. } | Static ( ..) | Const ( ..) | Fn ( ..) | Enum ( ..) | Struct ( ..) | Union ( ..) | Trait ( ..)
306
- )
307
- }
0 commit comments