@@ -16,7 +16,7 @@ use rustc_ast::ast::{IntTy, LitIntType, LitKind, StrStyle, UintTy};
1616use rustc_hir:: {
1717 Block , BlockCheckMode , Closure , Destination , Expr , ExprKind , FieldDef , FnHeader , Impl , ImplItem , ImplItemKind ,
1818 IsAuto , Item , ItemKind , LoopSource , MatchSource , QPath , TraitItem , TraitItemKind , UnOp , UnsafeSource , Unsafety ,
19- Variant , VariantData , VisibilityKind , YieldSource ,
19+ Variant , VariantData , YieldSource ,
2020} ;
2121use rustc_lint:: { LateContext , LintContext } ;
2222use rustc_middle:: ty:: TyCtxt ;
@@ -196,7 +196,7 @@ fn item_search_pat(item: &Item<'_>) -> (Pat, Pat) {
196196 ItemKind :: Impl ( _) => ( Pat :: Str ( "impl" ) , Pat :: Str ( "}" ) ) ,
197197 _ => return ( Pat :: Str ( "" ) , Pat :: Str ( "" ) ) ,
198198 } ;
199- if matches ! ( item. vis . node , VisibilityKind :: Inherited ) {
199+ if item. vis_span . is_empty ( ) {
200200 ( start_pat, end_pat)
201201 } else {
202202 ( Pat :: Str ( "pub" ) , end_pat)
@@ -217,15 +217,15 @@ fn impl_item_search_pat(item: &ImplItem<'_>) -> (Pat, Pat) {
217217 ImplItemKind :: TyAlias ( ..) => ( Pat :: Str ( "type" ) , Pat :: Str ( ";" ) ) ,
218218 ImplItemKind :: Fn ( sig, ..) => ( fn_header_search_pat ( sig. header ) , Pat :: Str ( "" ) ) ,
219219 } ;
220- if matches ! ( item. vis . node , VisibilityKind :: Inherited ) {
220+ if item. vis_span . is_empty ( ) {
221221 ( start_pat, end_pat)
222222 } else {
223223 ( Pat :: Str ( "pub" ) , end_pat)
224224 }
225225}
226226
227227fn field_def_search_pat ( def : & FieldDef < ' _ > ) -> ( Pat , Pat ) {
228- if matches ! ( def. vis . node , VisibilityKind :: Inherited ) {
228+ if def. vis_span . is_empty ( ) {
229229 if def. is_positional ( ) {
230230 ( Pat :: Str ( "" ) , Pat :: Str ( "" ) )
231231 } else {
0 commit comments