File tree Expand file tree Collapse file tree 2 files changed +332
-322
lines changed Expand file tree Collapse file tree 2 files changed +332
-322
lines changed Original file line number Diff line number Diff line change @@ -94,25 +94,26 @@ fn update_lints(update_mode: &UpdateMode) {
94
94
let mut sorted_usable_lints = usable_lints. clone ( ) ;
95
95
sorted_usable_lints. sort_by_key ( |lint| lint. name . clone ( ) ) ;
96
96
97
- std :: fs :: write (
97
+ let mut file_change = replace_region_in_file (
98
98
"../src/lintlist/mod.rs" ,
99
- & format ! (
100
- "\
101
- //! This file is managed by `util/dev update_lints`. Do not edit.
102
-
103
- pub mod lint;
104
- pub use lint::Level;
105
- pub use lint::Lint;
106
- pub use lint::LINT_LEVELS;
107
-
108
- pub const ALL_LINTS: [Lint; {}] = {:#?};\n " ,
109
- sorted_usable_lints. len( ) ,
110
- sorted_usable_lints
111
- ) ,
99
+ "begin lint list" ,
100
+ "end lint list" ,
101
+ false ,
102
+ update_mode == & UpdateMode :: Change ,
103
+ || {
104
+ format ! (
105
+ "pub const ALL_LINTS: [Lint; {}] = {:#?};" ,
106
+ sorted_usable_lints. len( ) ,
107
+ sorted_usable_lints
108
+ )
109
+ . lines ( )
110
+ . map ( ToString :: to_string)
111
+ . collect :: < Vec < _ > > ( )
112
+ } ,
112
113
)
113
- . expect ( "can write to file" ) ;
114
+ . changed ;
114
115
115
- let mut file_change = replace_region_in_file (
116
+ file_change | = replace_region_in_file (
116
117
"../README.md" ,
117
118
r#"\[There are \d+ lints included in this crate!\]\(https://rust-lang.github.io/rust-clippy/master/index.html\)"# ,
118
119
"" ,
You can’t perform that action at this time.
0 commit comments