@@ -277,62 +277,59 @@ crate-type = ["lib"]
277277 fn run_build ( & self , cargo_cmd : Command ) -> Result < Vec < RustcArtifact > > {
278278 let support_color = std:: io:: stdout ( ) . is_terminal ( ) ;
279279 let mut artifacts = vec ! [ ] ;
280- if let Some ( mut cargo_process) = self . run_piped ( cargo_cmd) ? {
281- let reader = BufReader :: new ( cargo_process. stdout . take ( ) . unwrap ( ) ) ;
282- let mut error_count = 0 ;
283- for message in Message :: parse_stream ( reader) {
284- let message = message. unwrap ( ) ;
285- match message {
286- Message :: CompilerMessage ( msg) => match msg. message . level {
287- DiagnosticLevel :: FailureNote => {
288- print_msg ( & msg. message , support_color) ?;
289- }
290- DiagnosticLevel :: Error => {
291- error_count += 1 ;
292- print_msg ( & msg. message , support_color) ?;
293- }
294- DiagnosticLevel :: Ice => {
295- print_msg ( & msg. message , support_color) ?;
296- let _ = cargo_process. wait ( ) ;
297- return Err ( anyhow:: Error :: msg ( msg. message ) . context ( format ! (
298- "Failed to compile `{}` due to an internal compiler error." ,
299- msg. target. name
300- ) ) ) ;
301- }
302- _ => {
303- if !self . args . common_args . quiet {
304- print_msg ( & msg. message , support_color) ?;
305- }
306- }
307- } ,
308- Message :: CompilerArtifact ( rustc_artifact) => {
309- // Compares two targets, and falls back to a weaker
310- // comparison where we avoid dashes in their names.
311- artifacts. push ( rustc_artifact)
280+ let mut cargo_process = self . run_piped ( cargo_cmd) ?;
281+ let reader = BufReader :: new ( cargo_process. stdout . take ( ) . unwrap ( ) ) ;
282+ let mut error_count = 0 ;
283+ for message in Message :: parse_stream ( reader) {
284+ let message = message. unwrap ( ) ;
285+ match message {
286+ Message :: CompilerMessage ( msg) => match msg. message . level {
287+ DiagnosticLevel :: FailureNote => {
288+ print_msg ( & msg. message , support_color) ?;
312289 }
313- Message :: BuildScriptExecuted ( _) | Message :: BuildFinished ( _) => {
314- // do nothing
290+ DiagnosticLevel :: Error => {
291+ error_count += 1 ;
292+ print_msg ( & msg. message , support_color) ?;
315293 }
316- Message :: TextLine ( msg) => {
317- if !self . args . common_args . quiet {
318- println ! ( "{msg}" ) ;
319- }
294+ DiagnosticLevel :: Ice => {
295+ print_msg ( & msg. message , support_color) ?;
296+ let _ = cargo_process. wait ( ) ;
297+ return Err ( anyhow:: Error :: msg ( msg. message ) . context ( format ! (
298+ "Failed to compile `{}` due to an internal compiler error." ,
299+ msg. target. name
300+ ) ) ) ;
320301 }
321-
322- // Non-exhaustive enum.
323302 _ => {
324303 if !self . args . common_args . quiet {
325- println ! ( "{ message:?}" ) ;
304+ print_msg ( & msg . message , support_color ) ? ;
326305 }
327306 }
307+ } ,
308+ Message :: CompilerArtifact ( rustc_artifact) => {
309+ // Compares two targets, and falls back to a weaker
310+ // comparison where we avoid dashes in their names.
311+ artifacts. push ( rustc_artifact)
312+ }
313+ Message :: BuildScriptExecuted ( _) | Message :: BuildFinished ( _) => {
314+ // do nothing
315+ }
316+ Message :: TextLine ( msg) => {
317+ if !self . args . common_args . quiet {
318+ println ! ( "{msg}" ) ;
319+ }
320+ }
321+
322+ // Non-exhaustive enum.
323+ _ => {
324+ if !self . args . common_args . quiet {
325+ println ! ( "{message:?}" ) ;
326+ }
328327 }
329328 }
330- let status = cargo_process. wait ( ) ?;
331- if !status. success ( ) {
332- bail ! (
333- "Failed to execute cargo ({status}). Found {error_count} compilation errors."
334- ) ;
335- }
329+ }
330+ let status = cargo_process. wait ( ) ?;
331+ if !status. success ( ) {
332+ bail ! ( "Failed to execute cargo ({status}). Found {error_count} compilation errors." ) ;
336333 }
337334 Ok ( artifacts)
338335 }
@@ -383,7 +380,7 @@ crate-type = ["lib"]
383380 cmd. arg ( pkg) ;
384381 // For some reason clippy cannot see that we are invoking wait() in the next line.
385382 #[ allow( clippy:: zombie_processes) ]
386- let mut process = self . run_piped ( cmd) ?. unwrap ( ) ;
383+ let mut process = self . run_piped ( cmd) ?;
387384 let result = process. wait ( ) ?;
388385 if !result. success ( ) {
389386 bail ! ( "Failed to retrieve information for `{pkg}`" ) ;
0 commit comments