@@ -244,21 +244,16 @@ pub fn read_deprecated_lints() -> DeprecatedLints {
244244 #[ allow( clippy:: enum_glob_use) ]
245245 use Token :: * ;
246246 #[ rustfmt:: skip]
247- static DECL_TOKENS : & [ Token ] = & [
247+ static VERSIONED_DECL : & [ Token ] = & [
248248 // #[clippy::version = "version"]
249249 Pound , OpenBracket , Ident ( "clippy" ) , DoubleColon , Ident ( "version" ) , Eq , LitStr , CloseBracket ,
250250 // ("first", "second"),
251251 OpenParen , CaptureLitStr , Comma , CaptureLitStr , CloseParen , Comma ,
252252 ] ;
253253 #[ 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 ,
262257 ] ;
263258
264259 let path = "clippy_lints/src/deprecated_lints.rs" ;
@@ -276,14 +271,14 @@ pub fn read_deprecated_lints() -> DeprecatedLints {
276271
277272 // First instance is the macro definition.
278273 assert ! (
279- searcher. find_token( Ident ( "declare_with_version " ) ) ,
274+ searcher. find_token( Ident ( "deprecated " ) ) ,
280275 "error reading deprecated lints"
281276 ) ;
282277
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 [ ] ) {
284279 let mut name = "" ;
285280 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] ) {
287282 res. deprecated . push ( DeprecatedLint {
288283 name : parse_str_single_line ( path. as_ref ( ) , name) ,
289284 reason : parse_str_single_line ( path. as_ref ( ) , reason) ,
@@ -292,13 +287,15 @@ pub fn read_deprecated_lints() -> DeprecatedLints {
292287 } else {
293288 panic ! ( "error reading deprecated lints" ) ;
294289 }
295- // position of the closing `]} ` of `declare_with_version `
290+ // position of the closing `]; ` of `deprecated `
296291 res. deprecated_end = searcher. pos ( ) ;
297292
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 ) {
299296 let mut old_name = "" ;
300297 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] ) {
302299 res. renamed . push ( RenamedLint {
303300 old_name : parse_str_single_line ( path. as_ref ( ) , old_name) ,
304301 new_name : parse_str_single_line ( path. as_ref ( ) , new_name) ,
@@ -307,7 +304,7 @@ pub fn read_deprecated_lints() -> DeprecatedLints {
307304 } else {
308305 panic ! ( "error reading renamed lints" ) ;
309306 }
310- // position of the closing `]} ` of `declare_with_version `
307+ // position of the closing `]; ` of `RENAMED `
311308 res. renamed_end = searcher. pos ( ) ;
312309
313310 res
0 commit comments