@@ -2,10 +2,11 @@ use clippy_utils::diagnostics::span_lint_and_then;
22use clippy_utils:: source:: { SpanRangeExt , snippet_indent} ;
33use clippy_utils:: tokenize_with_text;
44use itertools:: Itertools ;
5- use rustc_ast:: AttrStyle ;
65use rustc_ast:: token:: CommentKind ;
6+ use rustc_ast:: AttrStyle ;
77use rustc_errors:: { Applicability , Diag , SuggestionStyle } ;
8- use rustc_hir:: { AttrKind , Attribute , ItemKind , Node } ;
8+ use rustc_hir:: { Attribute , ItemKind , Node } ;
9+ use rustc_attr_parsing:: AttributeKind ;
910use rustc_lexer:: TokenKind ;
1011use rustc_lint:: LateContext ;
1112use rustc_span:: { BytePos , ExpnKind , InnerSpan , Span , SpanData } ;
@@ -67,14 +68,14 @@ impl Stop {
6768 }
6869
6970 fn from_attr ( cx : & LateContext < ' _ > , attr : & Attribute ) -> Option < Self > {
70- let SpanData { lo, hi, .. } = attr. span . data ( ) ;
71+ let SpanData { lo, hi, .. } = attr. span ( ) . data ( ) ;
7172 let file = cx. tcx . sess . source_map ( ) . lookup_source_file ( lo) ;
7273
7374 Some ( Self {
74- span : attr. span ,
75- kind : match attr. kind {
76- AttrKind :: Normal ( _ ) => StopKind :: Attr ,
77- AttrKind :: DocComment ( comment_kind , _ ) => StopKind :: Doc ( comment_kind ) ,
75+ span : attr. span ( ) ,
76+ kind : match attr {
77+ Attribute :: Parsed ( AttributeKind :: DocComment { kind , .. } ) => StopKind :: Doc ( * kind ) ,
78+ _ => StopKind :: Attr ,
7879 } ,
7980 first : file. lookup_line ( file. relative_position ( lo) ) ?,
8081 last : file. lookup_line ( file. relative_position ( hi) ) ?,
@@ -300,7 +301,7 @@ fn check_gaps(cx: &LateContext<'_>, gaps: &[Gap<'_>]) -> bool {
300301pub ( super ) fn check ( cx : & LateContext < ' _ > , attrs : & [ Attribute ] ) -> bool {
301302 let mut outer = attrs
302303 . iter ( )
303- . filter ( |attr| attr. style == AttrStyle :: Outer && !attr. span . from_expansion ( ) )
304+ . filter ( |attr| attr. style ( ) == AttrStyle :: Outer && !attr. span ( ) . from_expansion ( ) )
304305 . map ( |attr| Stop :: from_attr ( cx, attr) )
305306 . collect :: < Option < Vec < _ > > > ( )
306307 . unwrap_or_default ( ) ;
0 commit comments