1- use crate :: parse:: { ActiveLint , DeprecatedLint , Lint , ParsedData } ;
1+ use crate :: parse:: { ActiveLint , DeprecatedLint , LintKind , ParsedData } ;
22use crate :: update_lints:: generate_lint_files;
33use crate :: utils:: { FileUpdater , UpdateMode , UpdateStatus , Version , delete_dir_if_exists, delete_file_if_exists} ;
44use core:: mem;
@@ -24,9 +24,9 @@ pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
2424 eprintln ! ( "error: failed to find lint `{name}`" ) ;
2525 return ;
2626 } ;
27- let Lint :: Active ( lint) = mem:: replace (
28- entry,
29- Lint :: Deprecated ( DeprecatedLint {
27+ let LintKind :: Active ( lint) = mem:: replace (
28+ & mut entry. kind ,
29+ LintKind :: Deprecated ( DeprecatedLint {
3030 reason : reason. into ( ) ,
3131 version : clippy_version. rust_display ( ) . to_string ( ) ,
3232 } ) ,
@@ -83,14 +83,10 @@ fn remove_lint_declaration(name: &str, lint: &ActiveLint, data: &ParsedData) {
8383 }
8484 }
8585
86- let lint_file = & data. source_map . files [ lint. span . file ] ;
86+ let lint_file = & data. source_map . files [ lint. decl_span . file ] ;
8787 if data. lints . values ( ) . any ( |l| {
88- if let Lint :: Active ( l) = l {
89- let other_file = & data. source_map . files [ l. span . file ] ;
90- other_file. krate == lint_file. krate && other_file. module . starts_with ( & lint_file. module )
91- } else {
92- false
93- }
88+ let other_file = & data. source_map . files [ l. name_span . file ] ;
89+ other_file. krate == lint_file. krate && other_file. module . starts_with ( & lint_file. module )
9490 } ) {
9591 // Try to delete a sub-module that matches the lint's name
9692 let removed_mod = if lint_file. path . file_name ( ) . map ( OsStr :: as_encoded_bytes) == Some ( b"mod.rs" ) {
@@ -107,23 +103,28 @@ fn remove_lint_declaration(name: &str, lint: &ActiveLint, data: &ParsedData) {
107103 && let mod_decl = format ! ( "\n mod {name};" )
108104 && let Some ( mod_start) = src. find ( & mod_decl)
109105 {
110- if mod_start < lint. span . start as usize {
106+ if mod_start < lint. decl_span . start as usize {
111107 (
112108 mod_start,
113109 mod_start + mod_decl. len ( ) ,
114- lint. span . start as usize ,
115- lint. span . end as usize ,
110+ lint. decl_span . start as usize ,
111+ lint. decl_span . end as usize ,
116112 )
117113 } else {
118114 (
119- lint. span . start as usize ,
120- lint. span . end as usize ,
115+ lint. decl_span . start as usize ,
116+ lint. decl_span . end as usize ,
121117 mod_start,
122118 mod_start + mod_decl. len ( ) ,
123119 )
124120 }
125121 } else {
126- ( lint. span . start as usize , lint. span . end as usize , src. len ( ) , src. len ( ) )
122+ (
123+ lint. decl_span . start as usize ,
124+ lint. decl_span . end as usize ,
125+ src. len ( ) ,
126+ src. len ( ) ,
127+ )
127128 } ;
128129 dst. push_str ( & src[ ..a] ) ;
129130 dst. push_str ( & src[ b..c] ) ;
0 commit comments