11use crate :: parse:: cursor:: { self , Capture , Cursor } ;
22use crate :: parse:: { ActiveLint , DeprecatedLint , Lint , LintData , LintName , ParseCx , RenamedLint } ;
3- use crate :: update_lints:: generate_lint_files;
43use crate :: utils:: {
54 ErrAction , FileUpdater , UpdateMode , UpdateStatus , Version , delete_dir_if_exists, delete_file_if_exists,
65 expect_action, try_rename_dir, try_rename_file, walk_dir_no_dot_or_target,
@@ -40,7 +39,7 @@ pub fn deprecate<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, name
4039 } ;
4140
4241 remove_lint_declaration ( name, & prev_lint, & data, & mut FileUpdater :: default ( ) ) ;
43- generate_lint_files ( UpdateMode :: Change , & data ) ;
42+ data . gen_decls ( UpdateMode :: Change ) ;
4443 println ! ( "info: `{name}` has successfully been deprecated" ) ;
4544 println ! ( "note: you must run `cargo uitest` to update the test results" ) ;
4645}
@@ -74,7 +73,7 @@ pub fn uplift<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
7473 updater. update_file ( e. path ( ) , & mut update_fn) ;
7574 }
7675 }
77- generate_lint_files ( UpdateMode :: Change , & data ) ;
76+ data . gen_decls ( UpdateMode :: Change ) ;
7877 println ! ( "info: `{old_name}` has successfully been uplifted as `{new_name}`" ) ;
7978 println ! ( "note: you must run `cargo uitest` to update the test results" ) ;
8079}
@@ -151,7 +150,7 @@ pub fn rename<'cx, 'env: 'cx>(cx: ParseCx<'cx>, clippy_version: Version, old_nam
151150 updater. update_file ( e. path ( ) , & mut update_fn) ;
152151 }
153152 }
154- generate_lint_files ( UpdateMode :: Change , & data ) ;
153+ data . gen_decls ( UpdateMode :: Change ) ;
155154
156155 println ! ( "Renamed `{old_name}` to `{new_name}`" ) ;
157156 println ! ( "All code referencing the old name has been updated" ) ;
@@ -172,11 +171,11 @@ fn remove_lint_declaration(name: &str, lint: &ActiveLint<'_>, data: &LintData<'_
172171 delete_file_if_exists ( lint. path . as_ref ( ) )
173172 } else {
174173 updater. update_file ( & lint. path , & mut |_, src, dst| -> UpdateStatus {
175- let mut start = & src[ ..lint. declaration_range . start ] ;
174+ let mut start = & src[ ..lint. declaration_range . start as usize ] ;
176175 if start. ends_with ( "\n \n " ) {
177176 start = & start[ ..start. len ( ) - 1 ] ;
178177 }
179- let mut end = & src[ lint. declaration_range . end ..] ;
178+ let mut end = & src[ lint. declaration_range . end as usize ..] ;
180179 if end. starts_with ( "\n \n " ) {
181180 end = & end[ 1 ..] ;
182181 }
0 commit comments