@@ -28,6 +28,7 @@ use std::time::Duration;
28
28
29
29
use cargo_metadata:: diagnostic:: { Diagnostic , DiagnosticLevel } ;
30
30
use cargo_metadata:: Message ;
31
+ use log:: { debug, error, trace, warn} ;
31
32
use rayon:: prelude:: * ;
32
33
use serde:: { Deserialize , Serialize } ;
33
34
use walkdir:: { DirEntry , WalkDir } ;
@@ -163,10 +164,10 @@ fn get(path: &str) -> Result<ureq::Response, ureq::Error> {
163
164
match ureq:: get ( path) . call ( ) {
164
165
Ok ( res) => return Ok ( res) ,
165
166
Err ( e) if retries >= MAX_RETRIES => return Err ( e) ,
166
- Err ( ureq:: Error :: Transport ( e) ) => eprintln ! ( "Error: {e}" ) ,
167
+ Err ( ureq:: Error :: Transport ( e) ) => error ! ( "{}" , e ) ,
167
168
Err ( e) => return Err ( e) ,
168
169
}
169
- eprintln ! ( "retrying in {retries} seconds..." ) ;
170
+ warn ! ( "retrying in {retries} seconds..." ) ;
170
171
thread:: sleep ( Duration :: from_secs ( u64:: from ( retries) ) ) ;
171
172
retries += 1 ;
172
173
}
@@ -234,7 +235,7 @@ impl CrateSource {
234
235
. expect ( "Failed to clone git repo!" )
235
236
. success ( )
236
237
{
237
- eprintln ! ( "Failed to clone {url} into {}" , repo_path. display( ) ) ;
238
+ warn ! ( "Failed to clone {url} into {}" , repo_path. display( ) ) ;
238
239
}
239
240
}
240
241
// check out the commit/branch/whatever
@@ -247,7 +248,7 @@ impl CrateSource {
247
248
. expect ( "Failed to check out commit" )
248
249
. success ( )
249
250
{
250
- eprintln ! ( "Failed to checkout {commit} of repo at {}" , repo_path. display( ) ) ;
251
+ warn ! ( "Failed to checkout {commit} of repo at {}" , repo_path. display( ) ) ;
251
252
}
252
253
253
254
Crate {
@@ -390,6 +391,8 @@ impl Crate {
390
391
391
392
cargo_clippy_args. extend ( clippy_args) ;
392
393
394
+ debug ! ( "Arguments passed to cargo clippy driver: {:?}" , cargo_clippy_args) ;
395
+
393
396
let all_output = Command :: new ( & cargo_clippy_path)
394
397
// use the looping index to create individual target dirs
395
398
. env ( "CARGO_TARGET_DIR" , shared_target_dir. join ( format ! ( "_{thread_index:?}" ) ) )
@@ -409,21 +412,19 @@ impl Crate {
409
412
let status = & all_output. status ;
410
413
411
414
if !status. success ( ) {
412
- eprintln ! (
413
- "\n WARNING: bad exit status after checking {} {} \n " ,
414
- self . name, self . version
415
- ) ;
415
+ warn ! ( "bad exit status after checking {} {} \n " , self . name, self . version) ;
416
416
}
417
417
418
418
if config. fix {
419
+ trace ! ( "{}" , stderr) ;
419
420
if let Some ( stderr) = stderr
420
421
. lines ( )
421
422
. find ( |line| line. contains ( "failed to automatically apply fixes suggested by rustc to crate" ) )
422
423
{
423
424
let subcrate = & stderr[ 63 ..] ;
424
- println ! (
425
- "ERROR: failed to apply some suggetion to {} / to (sub)crate {subcrate }" ,
426
- self . name
425
+ error ! (
426
+ "failed to apply some suggetion to {} / to (sub)crate {}" ,
427
+ self . name, subcrate
427
428
) ;
428
429
}
429
430
// fast path, we don't need the warnings anyway
@@ -449,7 +450,7 @@ fn build_clippy() {
449
450
. status ( )
450
451
. expect ( "Failed to build clippy!" ) ;
451
452
if !status. success ( ) {
452
- eprintln ! ( "Error: Failed to compile Clippy!" ) ;
453
+ error ! ( "Failed to compile Clippy!" ) ;
453
454
std:: process:: exit ( 1 ) ;
454
455
}
455
456
}
@@ -553,7 +554,7 @@ fn main() {
553
554
554
555
// assert that we launch lintcheck from the repo root (via cargo lintcheck)
555
556
if std:: fs:: metadata ( "lintcheck/Cargo.toml" ) . is_err ( ) {
556
- eprintln ! ( "lintcheck needs to be run from clippy's repo root!\n Use `cargo lintcheck` alternatively." ) ;
557
+ error ! ( "lintcheck needs to be run from clippy's repo root!\n Use `cargo lintcheck` alternatively." ) ;
557
558
std:: process:: exit ( 3 ) ;
558
559
}
559
560
@@ -615,8 +616,8 @@ fn main() {
615
616
. collect ( ) ;
616
617
617
618
if crates. is_empty ( ) {
618
- eprintln ! (
619
- "ERROR: could not find crate '{}' in lintcheck/lintcheck_crates.toml" ,
619
+ error ! (
620
+ "could not find crate '{}' in lintcheck/lintcheck_crates.toml" ,
620
621
config. only. unwrap( ) ,
621
622
) ;
622
623
std:: process:: exit ( 1 ) ;
@@ -693,8 +694,7 @@ fn main() {
693
694
let _ = write ! ( text, "{cratename}: '{msg}'" ) ;
694
695
}
695
696
696
- println ! ( "Writing logs to {}" , config. lintcheck_results_path. display( ) ) ;
697
- fs:: create_dir_all ( config. lintcheck_results_path . parent ( ) . unwrap ( ) ) . unwrap ( ) ;
697
+ println ! ( "Writing results to {}" , config. lintcheck_results_path. display( ) ) ;
698
698
fs:: write ( & config. lintcheck_results_path , text) . unwrap ( ) ;
699
699
700
700
print_stats ( old_stats, new_stats, & config. lint_filter ) ;
0 commit comments