@@ -2,10 +2,11 @@ use clippy_utils::diagnostics::span_lint_and_then;
2
2
use clippy_utils:: source:: { SpanRangeExt , snippet_indent} ;
3
3
use clippy_utils:: tokenize_with_text;
4
4
use itertools:: Itertools ;
5
- use rustc_ast:: AttrStyle ;
6
5
use rustc_ast:: token:: CommentKind ;
6
+ use rustc_ast:: AttrStyle ;
7
7
use 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 ;
9
10
use rustc_lexer:: TokenKind ;
10
11
use rustc_lint:: LateContext ;
11
12
use rustc_span:: { BytePos , ExpnKind , InnerSpan , Span , SpanData } ;
@@ -67,14 +68,14 @@ impl Stop {
67
68
}
68
69
69
70
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 ( ) ;
71
72
let file = cx. tcx . sess . source_map ( ) . lookup_source_file ( lo) ;
72
73
73
74
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 ,
78
79
} ,
79
80
first : file. lookup_line ( file. relative_position ( lo) ) ?,
80
81
last : file. lookup_line ( file. relative_position ( hi) ) ?,
@@ -300,7 +301,7 @@ fn check_gaps(cx: &LateContext<'_>, gaps: &[Gap<'_>]) -> bool {
300
301
pub ( super ) fn check ( cx : & LateContext < ' _ > , attrs : & [ Attribute ] ) -> bool {
301
302
let mut outer = attrs
302
303
. iter ( )
303
- . filter ( |attr| attr. style == AttrStyle :: Outer && !attr. span . from_expansion ( ) )
304
+ . filter ( |attr| attr. style ( ) == AttrStyle :: Outer && !attr. span ( ) . from_expansion ( ) )
304
305
. map ( |attr| Stop :: from_attr ( cx, attr) )
305
306
. collect :: < Option < Vec < _ > > > ( )
306
307
. unwrap_or_default ( ) ;
0 commit comments