@@ -140,19 +140,19 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
140
140
}
141
141
let rustfmt_config = t ! ( std:: fs:: read_to_string( & rustfmt_config) ) ;
142
142
let rustfmt_config: RustfmtConfig = t ! ( toml:: from_str( & rustfmt_config) ) ;
143
- let mut fmt_override = ignore:: overrides:: OverrideBuilder :: new ( & build. src ) ;
143
+ let mut override_builder = ignore:: overrides:: OverrideBuilder :: new ( & build. src ) ;
144
144
for ignore in rustfmt_config. ignore {
145
145
if ignore. starts_with ( '!' ) {
146
- // A `!`-prefixed entry could be added as a whitelisted entry in `fmt_override`, i.e.
147
- // strip the `!` prefix. But as soon as whitelisted entries are added, an
146
+ // A `!`-prefixed entry could be added as a whitelisted entry in `override_builder`,
147
+ // i.e. strip the `!` prefix. But as soon as whitelisted entries are added, an
148
148
// `OverrideBuilder` will only traverse those whitelisted entries, and won't traverse
149
149
// any files that aren't explicitly mentioned. No bueno! Maybe there's a way to combine
150
150
// explicit whitelisted entries and traversal of unmentioned files, but for now just
151
151
// forbid such entries.
152
152
eprintln ! ( "fmt error: `!`-prefixed entries are not supported in rustfmt.toml, sorry" ) ;
153
153
crate :: exit!( 1 ) ;
154
154
} else {
155
- fmt_override . add ( & format ! ( "!{ignore}" ) ) . expect ( & ignore) ;
155
+ override_builder . add ( & format ! ( "!{ignore}" ) ) . expect ( & ignore) ;
156
156
}
157
157
}
158
158
let git_available = match Command :: new ( "git" )
@@ -204,14 +204,14 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
204
204
// have `foo.rs` in the repository root it will also match
205
205
// against anything like `compiler/rustc_foo/src/foo.rs`,
206
206
// preventing the latter from being formatted.
207
- fmt_override . add ( & format ! ( "!/{untracked_path}" ) ) . expect ( & untracked_path) ;
207
+ override_builder . add ( & format ! ( "!/{untracked_path}" ) ) . expect ( & untracked_path) ;
208
208
}
209
209
if !all {
210
210
adjective = Some ( "modified" ) ;
211
211
match get_modified_rs_files ( build) {
212
212
Ok ( Some ( files) ) => {
213
213
for file in files {
214
- fmt_override . add ( & format ! ( "/{file}" ) ) . expect ( & file) ;
214
+ override_builder . add ( & format ! ( "/{file}" ) ) . expect ( & file) ;
215
215
}
216
216
}
217
217
Ok ( None ) => { }
@@ -229,7 +229,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
229
229
eprintln ! ( "fmt: warning: Could not find usable git. Skipping git-aware format checks" ) ;
230
230
}
231
231
232
- let fmt_override = fmt_override . build ( ) . unwrap ( ) ;
232
+ let override_ = override_builder . build ( ) . unwrap ( ) ; // `override` is a reserved keyword
233
233
234
234
let rustfmt_path = build. initial_rustfmt ( ) . unwrap_or_else ( || {
235
235
eprintln ! ( "fmt error: `x fmt` is not supported on this channel" ) ;
@@ -238,8 +238,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
238
238
assert ! ( rustfmt_path. exists( ) , "{}" , rustfmt_path. display( ) ) ;
239
239
let src = build. src . clone ( ) ;
240
240
let ( tx, rx) : ( SyncSender < PathBuf > , _ ) = std:: sync:: mpsc:: sync_channel ( 128 ) ;
241
- let walker =
242
- WalkBuilder :: new ( src. clone ( ) ) . types ( matcher) . overrides ( fmt_override) . build_parallel ( ) ;
241
+ let walker = WalkBuilder :: new ( src. clone ( ) ) . types ( matcher) . overrides ( override_) . build_parallel ( ) ;
243
242
244
243
// There is a lot of blocking involved in spawning a child process and reading files to format.
245
244
// Spawn more processes than available concurrency to keep the CPU busy.
0 commit comments