@@ -6,7 +6,6 @@ use std::process::Command;
6
6
use std:: sync:: Mutex ;
7
7
use std:: sync:: mpsc:: SyncSender ;
8
8
9
- use build_helper:: ci:: CiEnv ;
10
9
use build_helper:: git:: get_git_modified_files;
11
10
use ignore:: WalkBuilder ;
12
11
@@ -104,7 +103,7 @@ struct RustfmtConfig {
104
103
105
104
// Prints output describing a collection of paths, with lines such as "formatted modified file
106
105
// 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 ] ) {
108
107
let len = paths. len ( ) ;
109
108
let adjective =
110
109
if let Some ( adjective) = adjective { format ! ( "{adjective} " ) } else { String :: new ( ) } ;
@@ -115,7 +114,7 @@ fn print_paths(verb: &str, adjective: Option<&str>, paths: &[String]) {
115
114
} else {
116
115
println ! ( "fmt: {verb} {len} {adjective}files" ) ;
117
116
}
118
- if len > 1000 && !CiEnv :: is_ci ( ) {
117
+ if len > 1000 && !build . config . is_running_on_ci {
119
118
println ! ( "hint: if this number seems too high, try running `git fetch origin master`" ) ;
120
119
}
121
120
}
@@ -135,7 +134,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
135
134
// `--all` is specified or we are in CI. We check all files in CI to avoid bugs in
136
135
// `get_modified_rs_files` letting regressions slip through; we also care about CI time less
137
136
// 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 ;
139
138
140
139
let mut builder = ignore:: types:: TypesBuilder :: new ( ) ;
141
140
builder. add_defaults ( ) ;
@@ -190,7 +189,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
190
189
)
191
190
. map ( |x| x. to_string ( ) )
192
191
. collect ( ) ;
193
- print_paths ( "skipped" , Some ( "untracked" ) , & untracked_paths) ;
192
+ print_paths ( build , "skipped" , Some ( "untracked" ) , & untracked_paths) ;
194
193
195
194
for untracked_path in untracked_paths {
196
195
// The leading `/` makes it an exact match against the
@@ -319,7 +318,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
319
318
} ) ;
320
319
let mut paths = formatted_paths. into_inner ( ) . unwrap ( ) ;
321
320
paths. sort ( ) ;
322
- print_paths ( if check { "checked" } else { "formatted" } , adjective, & paths) ;
321
+ print_paths ( build , if check { "checked" } else { "formatted" } , adjective, & paths) ;
323
322
324
323
drop ( tx) ;
325
324
0 commit comments