@@ -244,21 +244,16 @@ pub fn read_deprecated_lints() -> DeprecatedLints {
244
244
#[ allow( clippy:: enum_glob_use) ]
245
245
use Token :: * ;
246
246
#[ rustfmt:: skip]
247
- static DECL_TOKENS : & [ Token ] = & [
247
+ static VERSIONED_DECL : & [ Token ] = & [
248
248
// #[clippy::version = "version"]
249
249
Pound , OpenBracket , Ident ( "clippy" ) , DoubleColon , Ident ( "version" ) , Eq , LitStr , CloseBracket ,
250
250
// ("first", "second"),
251
251
OpenParen , CaptureLitStr , Comma , CaptureLitStr , CloseParen , Comma ,
252
252
] ;
253
253
#[ rustfmt:: skip]
254
- static DEPRECATED_TOKENS : & [ Token ] = & [
255
- // !{ DEPRECATED(DEPRECATED_VERSION) = [
256
- Bang , OpenBrace , Ident ( "DEPRECATED" ) , OpenParen , Ident ( "DEPRECATED_VERSION" ) , CloseParen , Eq , OpenBracket ,
257
- ] ;
258
- #[ rustfmt:: skip]
259
- static RENAMED_TOKENS : & [ Token ] = & [
260
- // !{ RENAMED(RENAMED_VERSION) = [
261
- Bang , OpenBrace , Ident ( "RENAMED" ) , OpenParen , Ident ( "RENAMED_VERSION" ) , CloseParen , Eq , OpenBracket ,
254
+ static UNVERSIONED_DECL : & [ Token ] = & [
255
+ // ("first", "second"),
256
+ OpenParen , CaptureLitStr , Comma , CaptureLitStr , CloseParen , Comma ,
262
257
] ;
263
258
264
259
let path = "clippy_lints/src/deprecated_lints.rs" ;
@@ -276,14 +271,14 @@ pub fn read_deprecated_lints() -> DeprecatedLints {
276
271
277
272
// First instance is the macro definition.
278
273
assert ! (
279
- searcher. find_token( Ident ( "declare_with_version " ) ) ,
274
+ searcher. find_token( Ident ( "deprecated " ) ) ,
280
275
"error reading deprecated lints"
281
276
) ;
282
277
283
- if searcher. find_token ( Ident ( "declare_with_version " ) ) && searcher. match_tokens ( DEPRECATED_TOKENS , & mut [ ] ) {
278
+ if searcher. find_token ( Ident ( "deprecated " ) ) && searcher. match_tokens ( & [ Bang , OpenBracket ] , & mut [ ] ) {
284
279
let mut name = "" ;
285
280
let mut reason = "" ;
286
- while searcher. match_tokens ( DECL_TOKENS , & mut [ & mut name, & mut reason] ) {
281
+ while searcher. match_tokens ( VERSIONED_DECL , & mut [ & mut name, & mut reason] ) {
287
282
res. deprecated . push ( DeprecatedLint {
288
283
name : parse_str_single_line ( path. as_ref ( ) , name) ,
289
284
reason : parse_str_single_line ( path. as_ref ( ) , reason) ,
@@ -292,13 +287,15 @@ pub fn read_deprecated_lints() -> DeprecatedLints {
292
287
} else {
293
288
panic ! ( "error reading deprecated lints" ) ;
294
289
}
295
- // position of the closing `]} ` of `declare_with_version `
290
+ // position of the closing `]; ` of `deprecated `
296
291
res. deprecated_end = searcher. pos ( ) ;
297
292
298
- if searcher. find_token ( Ident ( "declare_with_version" ) ) && searcher. match_tokens ( RENAMED_TOKENS , & mut [ ] ) {
293
+ // pub const RENAMED: &[(&str, &str)] = &[
294
+ // ^^^^^^^ ^ ^
295
+ if searcher. find_token ( Ident ( "RENAMED" ) ) && searcher. find_token ( Eq ) && searcher. find_token ( OpenBracket ) {
299
296
let mut old_name = "" ;
300
297
let mut new_name = "" ;
301
- while searcher. match_tokens ( DECL_TOKENS , & mut [ & mut old_name, & mut new_name] ) {
298
+ while searcher. match_tokens ( UNVERSIONED_DECL , & mut [ & mut old_name, & mut new_name] ) {
302
299
res. renamed . push ( RenamedLint {
303
300
old_name : parse_str_single_line ( path. as_ref ( ) , old_name) ,
304
301
new_name : parse_str_single_line ( path. as_ref ( ) , new_name) ,
@@ -307,7 +304,7 @@ pub fn read_deprecated_lints() -> DeprecatedLints {
307
304
} else {
308
305
panic ! ( "error reading renamed lints" ) ;
309
306
}
310
- // position of the closing `]} ` of `declare_with_version `
307
+ // position of the closing `]; ` of `RENAMED `
311
308
res. renamed_end = searcher. pos ( ) ;
312
309
313
310
res
0 commit comments