@@ -113,9 +113,9 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
113
113
}
114
114
let rustfmt_config = t ! ( std:: fs:: read_to_string( & rustfmt_config) ) ;
115
115
let rustfmt_config: RustfmtConfig = t ! ( toml:: from_str( & rustfmt_config) ) ;
116
- let mut ignore_fmt = ignore:: overrides:: OverrideBuilder :: new ( & build. src ) ;
116
+ let mut fmt_override = ignore:: overrides:: OverrideBuilder :: new ( & build. src ) ;
117
117
for ignore in rustfmt_config. ignore {
118
- ignore_fmt . add ( & format ! ( "!{ignore}" ) ) . expect ( & ignore) ;
118
+ fmt_override . add ( & format ! ( "!{ignore}" ) ) . expect ( & ignore) ;
119
119
}
120
120
let git_available = match Command :: new ( "git" )
121
121
. arg ( "--version" )
@@ -161,38 +161,38 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
161
161
// against anything like `compiler/rustc_foo/src/foo.rs`,
162
162
// preventing the latter from being formatted.
163
163
untracked_count += 1 ;
164
- ignore_fmt . add ( & format ! ( "!/{untracked_path}" ) ) . expect ( & untracked_path) ;
164
+ fmt_override . add ( & format ! ( "!/{untracked_path}" ) ) . expect ( & untracked_path) ;
165
165
}
166
166
// Only check modified files locally to speed up runtime.
167
167
// We still check all files in CI to avoid bugs in `get_modified_rs_files` letting regressions slip through;
168
168
// we also care about CI time less since this is still very fast compared to building the compiler.
169
169
if !CiEnv :: is_ci ( ) && paths. is_empty ( ) {
170
170
match get_modified_rs_files ( build) {
171
171
Ok ( Some ( files) ) => {
172
- eprintln ! ( "Found {:?} modified files" , files) ;
173
172
if files. len ( ) <= 10 {
174
173
for file in & files {
175
174
println ! ( "formatting modified file {file}" ) ;
176
175
}
177
- }
178
- let pluralized = |count| if count > 1 { "files" } else { "file" } ;
179
- let untracked_msg = if untracked_count == 0 {
180
- "" . to_string ( )
181
176
} else {
182
- format ! (
183
- ", skipped {} untracked {}" ,
184
- untracked_count,
185
- pluralized( untracked_count) ,
186
- )
187
- } ;
188
- println ! (
189
- "formatting {} modified {}{}" ,
190
- files. len( ) ,
191
- pluralized( files. len( ) ) ,
192
- untracked_msg
193
- ) ;
177
+ let pluralized = |count| if count > 1 { "files" } else { "file" } ;
178
+ let untracked_msg = if untracked_count == 0 {
179
+ "" . to_string ( )
180
+ } else {
181
+ format ! (
182
+ ", skipped {} untracked {}" ,
183
+ untracked_count,
184
+ pluralized( untracked_count) ,
185
+ )
186
+ } ;
187
+ println ! (
188
+ "formatting {} modified {}{}" ,
189
+ files. len( ) ,
190
+ pluralized( files. len( ) ) ,
191
+ untracked_msg
192
+ ) ;
193
+ }
194
194
for file in files {
195
- ignore_fmt . add ( & format ! ( "/{file}" ) ) . expect ( & file) ;
195
+ fmt_override . add ( & format ! ( "/{file}" ) ) . expect ( & file) ;
196
196
}
197
197
}
198
198
Ok ( None ) => { }
@@ -213,7 +213,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
213
213
println ! ( "Could not find usable git. Skipping git-aware format checks" ) ;
214
214
}
215
215
216
- let ignore_fmt = ignore_fmt . build ( ) . unwrap ( ) ;
216
+ let fmt_override = fmt_override . build ( ) . unwrap ( ) ;
217
217
218
218
let rustfmt_path = build. initial_rustfmt ( ) . unwrap_or_else ( || {
219
219
eprintln ! ( "./x.py fmt is not supported on this channel" ) ;
@@ -269,7 +269,7 @@ pub fn format(build: &Builder<'_>, check: bool, paths: &[PathBuf]) {
269
269
None => WalkBuilder :: new ( src. clone ( ) ) ,
270
270
}
271
271
. types ( matcher)
272
- . overrides ( ignore_fmt )
272
+ . overrides ( fmt_override )
273
273
. build_parallel ( ) ;
274
274
275
275
// there is a lot of blocking involved in spawning a child process and reading files to format.
0 commit comments