@@ -140,19 +140,19 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
140140 }
141141 let rustfmt_config = t ! ( std:: fs:: read_to_string( & rustfmt_config) ) ;
142142 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 ) ;
144144 for ignore in rustfmt_config. ignore {
145145 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
148148 // `OverrideBuilder` will only traverse those whitelisted entries, and won't traverse
149149 // any files that aren't explicitly mentioned. No bueno! Maybe there's a way to combine
150150 // explicit whitelisted entries and traversal of unmentioned files, but for now just
151151 // forbid such entries.
152152 eprintln ! ( "fmt error: `!`-prefixed entries are not supported in rustfmt.toml, sorry" ) ;
153153 crate :: exit!( 1 ) ;
154154 } else {
155- fmt_override . add ( & format ! ( "!{ignore}" ) ) . expect ( & ignore) ;
155+ override_builder . add ( & format ! ( "!{ignore}" ) ) . expect ( & ignore) ;
156156 }
157157 }
158158 let git_available = match Command :: new ( "git" )
@@ -204,14 +204,14 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
204204 // have `foo.rs` in the repository root it will also match
205205 // against anything like `compiler/rustc_foo/src/foo.rs`,
206206 // 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) ;
208208 }
209209 if !all {
210210 adjective = Some ( "modified" ) ;
211211 match get_modified_rs_files ( build) {
212212 Ok ( Some ( files) ) => {
213213 for file in files {
214- fmt_override . add ( & format ! ( "/{file}" ) ) . expect ( & file) ;
214+ override_builder . add ( & format ! ( "/{file}" ) ) . expect ( & file) ;
215215 }
216216 }
217217 Ok ( None ) => { }
@@ -229,7 +229,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
229229 eprintln ! ( "fmt: warning: Could not find usable git. Skipping git-aware format checks" ) ;
230230 }
231231
232- let fmt_override = fmt_override . build ( ) . unwrap ( ) ;
232+ let override_ = override_builder . build ( ) . unwrap ( ) ; // `override` is a reserved keyword
233233
234234 let rustfmt_path = build. initial_rustfmt ( ) . unwrap_or_else ( || {
235235 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]) {
238238 assert ! ( rustfmt_path. exists( ) , "{}" , rustfmt_path. display( ) ) ;
239239 let src = build. src . clone ( ) ;
240240 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 ( ) ;
243242
244243 // There is a lot of blocking involved in spawning a child process and reading files to format.
245244 // Spawn more processes than available concurrency to keep the CPU busy.
0 commit comments