@@ -35,9 +35,9 @@ fn rustfmt(src: &Path, rustfmt: &Path, paths: &[PathBuf], check: bool) -> impl F
35
35
let status = cmd. wait ( ) . unwrap ( ) ;
36
36
if !status. success ( ) {
37
37
eprintln ! (
38
- "Running `{}` failed.\n If you're running `tidy`, \
39
- try again with `--bless`. Or, if you just want to format \
40
- code, run `./x.py fmt` instead.",
38
+ "fmt error: Running `{}` failed.\n If you're running `tidy`, \
39
+ try again with `--bless`. Or, if you just want to format \
40
+ code, run `./x.py fmt` instead.",
41
41
cmd_debug,
42
42
) ;
43
43
crate :: exit!( 1 ) ;
@@ -99,7 +99,7 @@ struct RustfmtConfig {
99
99
100
100
pub fn format ( build : & Builder < ' _ > , check : bool , all : bool , paths : & [ PathBuf ] ) {
101
101
if !paths. is_empty ( ) {
102
- eprintln ! ( "path arguments are not accepted" ) ;
102
+ eprintln ! ( "fmt error: path arguments are not accepted" ) ;
103
103
crate :: exit!( 1 ) ;
104
104
} ;
105
105
if build. config . dry_run ( ) {
@@ -118,8 +118,8 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
118
118
let matcher = builder. build ( ) . unwrap ( ) ;
119
119
let rustfmt_config = build. src . join ( "rustfmt.toml" ) ;
120
120
if !rustfmt_config. exists ( ) {
121
- eprintln ! ( "Not running formatting checks; rustfmt.toml does not exist." ) ;
122
- eprintln ! ( "This may happen in distributed tarballs." ) ;
121
+ eprintln ! ( "fmt error: Not running formatting checks; rustfmt.toml does not exist." ) ;
122
+ eprintln ! ( "fmt error: This may happen in distributed tarballs." ) ;
123
123
return ;
124
124
}
125
125
let rustfmt_config = t ! ( std:: fs:: read_to_string( & rustfmt_config) ) ;
@@ -133,7 +133,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
133
133
// any files that aren't explicitly mentioned. No bueno! Maybe there's a way to combine
134
134
// explicit whitelisted entries and traversal of unmentioned files, but for now just
135
135
// forbid such entries.
136
- eprintln ! ( "`!`-prefixed entries are not supported in rustfmt.toml, sorry" ) ;
136
+ eprintln ! ( "fmt error: `!`-prefixed entries are not supported in rustfmt.toml, sorry" ) ;
137
137
crate :: exit!( 1 ) ;
138
138
} else {
139
139
fmt_override. add ( & format ! ( "!{ignore}" ) ) . expect ( & ignore) ;
@@ -177,7 +177,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
177
177
) ;
178
178
let mut untracked_count = 0 ;
179
179
for untracked_path in untracked_paths {
180
- println ! ( "skip untracked path {untracked_path} during rustfmt invocations" ) ;
180
+ println ! ( "fmt: skip untracked path {untracked_path} during rustfmt invocations" ) ;
181
181
// The leading `/` makes it an exact match against the
182
182
// repository root, rather than a glob. Without that, if you
183
183
// have `foo.rs` in the repository root it will also match
@@ -191,7 +191,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
191
191
Ok ( Some ( files) ) => {
192
192
if files. len ( ) <= 10 {
193
193
for file in & files {
194
- println ! ( "formatting modified file {file}" ) ;
194
+ println ! ( "fmt: formatting modified file {file}" ) ;
195
195
}
196
196
} else {
197
197
let pluralized = |count| if count > 1 { "files" } else { "file" } ;
@@ -205,7 +205,7 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
205
205
)
206
206
} ;
207
207
println ! (
208
- "formatting {} modified {}{}" ,
208
+ "fmt: formatting {} modified {}{}" ,
209
209
files. len( ) ,
210
210
pluralized( files. len( ) ) ,
211
211
untracked_msg
@@ -217,24 +217,23 @@ pub fn format(build: &Builder<'_>, check: bool, all: bool, paths: &[PathBuf]) {
217
217
}
218
218
Ok ( None ) => { }
219
219
Err ( err) => {
220
- println ! (
221
- "WARN: Something went wrong when running git commands:\n {err}\n \
222
- Falling back to formatting all files."
223
- ) ;
220
+ eprintln ! ( "fmt warning: Something went wrong running git commands:" ) ;
221
+ eprintln ! ( "fmt warning: {err}" ) ;
222
+ eprintln ! ( "fmt warning: Falling back to formatting all files." ) ;
224
223
}
225
224
}
226
225
}
227
226
} else {
228
- println ! ( "Not in git tree. Skipping git-aware format checks" ) ;
227
+ eprintln ! ( "fmt: warning: Not in git tree. Skipping git-aware format checks" ) ;
229
228
}
230
229
} else {
231
- println ! ( "Could not find usable git. Skipping git-aware format checks" ) ;
230
+ eprintln ! ( "fmt: warning: Could not find usable git. Skipping git-aware format checks" ) ;
232
231
}
233
232
234
233
let fmt_override = fmt_override. build ( ) . unwrap ( ) ;
235
234
236
235
let rustfmt_path = build. initial_rustfmt ( ) . unwrap_or_else ( || {
237
- eprintln ! ( "./x.py fmt is not supported on this channel" ) ;
236
+ eprintln ! ( "fmt error: `x fmt` is not supported on this channel" ) ;
238
237
crate :: exit!( 1 ) ;
239
238
} ) ;
240
239
assert ! ( rustfmt_path. exists( ) , "{}" , rustfmt_path. display( ) ) ;
0 commit comments