@@ -98,7 +98,6 @@ pub struct DeprecatedLint<'cx> {
9898pub struct RenamedLint < ' cx > {
9999 pub old_name : & ' cx str ,
100100 pub new_name : & ' cx str ,
101- pub version : & ' cx str ,
102101}
103102
104103impl < ' cx > ParseCxImpl < ' cx > {
@@ -186,21 +185,16 @@ impl<'cx> ParseCxImpl<'cx> {
186185 #[ allow( clippy:: enum_glob_use) ]
187186 use cursor:: Pat :: * ;
188187 #[ rustfmt:: skip]
189- static DECL_TOKENS : & [ cursor:: Pat < ' _ > ] = & [
188+ static VERSIONED_DECL : & [ cursor:: Pat < ' _ > ] = & [
190189 // #[clippy::version = "version"]
191190 Pound , OpenBracket , Ident ( "clippy" ) , DoubleColon , Ident ( "version" ) , Eq , CaptureLitStr , CloseBracket ,
192191 // ("first", "second"),
193192 OpenParen , CaptureLitStr , Comma , CaptureLitStr , CloseParen , Comma ,
194193 ] ;
195194 #[ rustfmt:: skip]
196- static DEPRECATED_TOKENS : & [ cursor:: Pat < ' _ > ] = & [
197- // !{ DEPRECATED(DEPRECATED_VERSION) = [
198- Bang , OpenBrace , Ident ( "DEPRECATED" ) , OpenParen , Ident ( "DEPRECATED_VERSION" ) , CloseParen , Eq , OpenBracket ,
199- ] ;
200- #[ rustfmt:: skip]
201- static RENAMED_TOKENS : & [ cursor:: Pat < ' _ > ] = & [
202- // !{ RENAMED(RENAMED_VERSION) = [
203- Bang , OpenBrace , Ident ( "RENAMED" ) , OpenParen , Ident ( "RENAMED_VERSION" ) , CloseParen , Eq , OpenBracket ,
195+ static UNVERSIONED_DECL : & [ cursor:: Pat < ' _ > ] = & [
196+ // ("first", "second"),
197+ OpenParen , CaptureLitStr , Comma , CaptureLitStr , CloseParen , Comma ,
204198 ] ;
205199
206200 let path = "clippy_lints/src/deprecated_lints.rs" ;
@@ -214,12 +208,12 @@ impl<'cx> ParseCxImpl<'cx> {
214208
215209 // First instance is the macro definition.
216210 assert ! (
217- cursor. find_ident( "declare_with_version " ) . is_some( ) ,
211+ cursor. find_ident( "deprecated " ) . is_some( ) ,
218212 "error reading deprecated lints"
219213 ) ;
220214
221- if cursor. find_ident ( "declare_with_version " ) . is_some ( ) && cursor. match_all ( DEPRECATED_TOKENS , & mut [ ] ) {
222- while cursor. match_all ( DECL_TOKENS , & mut captures) {
215+ if cursor. find_ident ( "deprecated " ) . is_some ( ) && cursor. match_all ( & [ Bang , OpenBracket ] , & mut [ ] ) {
216+ while cursor. match_all ( VERSIONED_DECL , & mut captures) {
223217 deprecated. push ( DeprecatedLint {
224218 name : self . parse_str_single_line ( path. as_ref ( ) , cursor. get_text ( captures[ 1 ] ) ) ,
225219 reason : self . parse_str_single_line ( path. as_ref ( ) , cursor. get_text ( captures[ 2 ] ) ) ,
@@ -230,12 +224,13 @@ impl<'cx> ParseCxImpl<'cx> {
230224 panic ! ( "error reading deprecated lints" ) ;
231225 }
232226
233- if cursor. find_ident ( "declare_with_version" ) . is_some ( ) && cursor. match_all ( RENAMED_TOKENS , & mut [ ] ) {
234- while cursor. match_all ( DECL_TOKENS , & mut captures) {
227+ // pub const RENAMED: &[(&str, &str)] = &[
228+ // ^^^^^^^ ^ ^
229+ if cursor. find_ident ( "RENAMED" ) . is_some ( ) && cursor. find_pat ( Eq ) && cursor. find_pat ( OpenBracket ) {
230+ while cursor. match_all ( UNVERSIONED_DECL , & mut captures) {
235231 renamed. push ( RenamedLint {
236- old_name : self . parse_str_single_line ( path. as_ref ( ) , cursor. get_text ( captures[ 1 ] ) ) ,
237- new_name : self . parse_str_single_line ( path. as_ref ( ) , cursor. get_text ( captures[ 2 ] ) ) ,
238- version : self . parse_str_single_line ( path. as_ref ( ) , cursor. get_text ( captures[ 0 ] ) ) ,
232+ old_name : self . parse_str_single_line ( path. as_ref ( ) , cursor. get_text ( captures[ 0 ] ) ) ,
233+ new_name : self . parse_str_single_line ( path. as_ref ( ) , cursor. get_text ( captures[ 1 ] ) ) ,
239234 } ) ;
240235 }
241236 } else {
0 commit comments