1
- use crate :: parse:: { ActiveLint , DeprecatedLint , Lint , ParsedData } ;
1
+ use crate :: parse:: { ActiveLint , DeprecatedLint , LintKind , ParsedData } ;
2
2
use crate :: update_lints:: generate_lint_files;
3
3
use crate :: utils:: { FileUpdater , UpdateMode , UpdateStatus , Version , delete_dir_if_exists, delete_file_if_exists} ;
4
4
use core:: mem;
@@ -24,9 +24,9 @@ pub fn deprecate(clippy_version: Version, name: &str, reason: &str) {
24
24
eprintln ! ( "error: failed to find lint `{name}`" ) ;
25
25
return ;
26
26
} ;
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 {
30
30
reason : reason. into ( ) ,
31
31
version : clippy_version. rust_display ( ) . to_string ( ) ,
32
32
} ) ,
@@ -83,14 +83,10 @@ fn remove_lint_declaration(name: &str, lint: &ActiveLint, data: &ParsedData) {
83
83
}
84
84
}
85
85
86
- let lint_file = & data. source_map . files [ lint. span . file ] ;
86
+ let lint_file = & data. source_map . files [ lint. decl_span . file ] ;
87
87
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 )
94
90
} ) {
95
91
// Try to delete a sub-module that matches the lint's name
96
92
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) {
107
103
&& let mod_decl = format ! ( "\n mod {name};" )
108
104
&& let Some ( mod_start) = src. find ( & mod_decl)
109
105
{
110
- if mod_start < lint. span . start as usize {
106
+ if mod_start < lint. decl_span . start as usize {
111
107
(
112
108
mod_start,
113
109
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 ,
116
112
)
117
113
} else {
118
114
(
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 ,
121
117
mod_start,
122
118
mod_start + mod_decl. len ( ) ,
123
119
)
124
120
}
125
121
} 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
+ )
127
128
} ;
128
129
dst. push_str ( & src[ ..a] ) ;
129
130
dst. push_str ( & src[ b..c] ) ;
0 commit comments