@@ -87,11 +87,8 @@ const SEGMENTS_MSG: &str = "segments should be composed of at least 1 element";
8787
8888impl < ' tcx > LateLintPass < ' tcx > for UseSelf {
8989 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 <..>`
9592 return ;
9693 }
9794 // 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 {
119116 }
120117
121118 fn check_item_post ( & mut self , _: & LateContext < ' _ > , item : & Item < ' _ > ) {
122- if is_item_interesting ( item) {
119+ if ! matches ! ( item. kind , ItemKind :: OpaqueTy ( _ ) ) {
123120 self . stack . pop ( ) ;
124121 }
125122 }
@@ -297,11 +294,3 @@ fn lint_path_to_variant(cx: &LateContext<'_>, path: &Path<'_>) {
297294 span_lint ( cx, span) ;
298295 }
299296}
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