@@ -6,7 +6,6 @@ use std::process::Command;
66use std:: sync:: Mutex ;
77use std:: sync:: mpsc:: SyncSender ;
88
9- use build_helper:: ci:: CiEnv ;
109use build_helper:: git:: get_git_modified_files;
1110use ignore:: WalkBuilder ;
1211
@@ -104,7 +103,7 @@ struct RustfmtConfig {
104103
105104// Prints output describing a collection of paths, with lines such as "formatted modified file
106105// foo/bar/baz" or "skipped 20 untracked files".
107- fn print_paths ( verb : & str , adjective : Option < & str > , paths : & [ String ] ) {
106+ fn print_paths ( build : & Builder < ' _ > , verb : & str , adjective : Option < & str > , paths : & [ String ] ) {
108107 let len = paths. len ( ) ;
109108 let adjective =
110109 if let Some ( adjective) = adjective { format ! ( "{adjective} " ) } else { String :: new ( ) } ;
@@ -115,7 +114,7 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) {
115114 } else {
116115 println ! ( "fmt: {verb} {len} {adjective}files" ) ;
117116 }
118- if len > 1000 && !CiEnv :: is_ci ( ) {
117+ if len > 1000 && !build . config . is_running_on_ci {
119118 println ! ( "hint: if this number seems too high, try running `git fetch origin master`" ) ;
120119 }
121120}
@@ -135,7 +134,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
135134 // `--all` is specified or we are in CI. We check all files in CI to avoid bugs in
136135 // `get_modified_rs_files` letting regressions slip through; we also care about CI time less
137136 // since this is still very fast compared to building the compiler.
138- let all = all || CiEnv :: is_ci ( ) ;
137+ let all = all || build . config . is_running_on_ci ;
139138
140139 let mut builder = ignore:: types:: TypesBuilder :: new ( ) ;
141140 builder. add_defaults ( ) ;
@@ -190,7 +189,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
190189 )
191190 . map ( |x| x. to_string ( ) )
192191 . collect ( ) ;
193- print_paths ( "skipped" , Some ( "untracked" ) , & untracked_paths) ;
192+ print_paths ( build , "skipped" , Some ( "untracked" ) , & untracked_paths) ;
194193
195194 for untracked_path in untracked_paths {
196195 // The leading `/` makes it an exact match against the
@@ -319,7 +318,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
319318 } ) ;
320319 let mut paths = formatted_paths. into_inner ( ) . unwrap ( ) ;
321320 paths. sort ( ) ;
322- print_paths ( if check { "checked" } else { "formatted" } , adjective, & paths) ;
321+ print_paths ( build , if check { "checked" } else { "formatted" } , adjective, & paths) ;
323322
324323 drop ( tx) ;
325324
0 commit comments