@@ -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
}
@@ -246,7 +247,7 @@ impl CrateSource {
246
247
. expect ( "Failed to clone git repo!" )
247
248
. success ( )
248
249
{
249
- eprintln ! ( "Failed to clone {url} into {}" , repo_path. display( ) ) ;
250
+ warn ! ( "Failed to clone {url} into {}" , repo_path. display( ) ) ;
250
251
}
251
252
}
252
253
// check out the commit/branch/whatever
@@ -259,7 +260,7 @@ impl CrateSource {
259
260
. expect ( "Failed to check out commit" )
260
261
. success ( )
261
262
{
262
- eprintln ! ( "Failed to checkout {commit} of repo at {}" , repo_path. display( ) ) ;
263
+ warn ! ( "Failed to checkout {commit} of repo at {}" , repo_path. display( ) ) ;
263
264
}
264
265
265
266
Crate {
@@ -407,6 +408,8 @@ impl Crate {
407
408
408
409
cargo_clippy_args. extend ( clippy_args) ;
409
410
411
+ debug ! ( "Arguments passed to cargo clippy driver: {:?}" , cargo_clippy_args) ;
412
+
410
413
let all_output = Command :: new ( & cargo_clippy_path)
411
414
// use the looping index to create individual target dirs
412
415
. env ( "CARGO_TARGET_DIR" , shared_target_dir. join ( format ! ( "_{thread_index:?}" ) ) )
@@ -427,21 +430,19 @@ impl Crate {
427
430
let status = & all_output. status ;
428
431
429
432
if !status. success ( ) {
430
- eprintln ! (
431
- "\n WARNING: bad exit status after checking {} {} \n " ,
432
- self . name, self . version
433
- ) ;
433
+ warn ! ( "bad exit status after checking {} {} \n " , self . name, self . version) ;
434
434
}
435
435
436
436
if config. fix {
437
+ trace ! ( "{}" , stderr) ;
437
438
if let Some ( stderr) = stderr
438
439
. lines ( )
439
440
. find ( |line| line. contains ( "failed to automatically apply fixes suggested by rustc to crate" ) )
440
441
{
441
442
let subcrate = & stderr[ 63 ..] ;
442
- println ! (
443
- "ERROR: failed to apply some suggetion to {} / to (sub)crate {subcrate }" ,
444
- self . name
443
+ error ! (
444
+ "failed to apply some suggetion to {} / to (sub)crate {}" ,
445
+ self . name, subcrate
445
446
) ;
446
447
}
447
448
// fast path, we don't need the warnings anyway
@@ -467,7 +468,7 @@ fn build_clippy() {
467
468
. status ( )
468
469
. expect ( "Failed to build clippy!" ) ;
469
470
if !status. success ( ) {
470
- eprintln ! ( "Error: Failed to compile Clippy!" ) ;
471
+ error ! ( "Failed to compile Clippy!" ) ;
471
472
std:: process:: exit ( 1 ) ;
472
473
}
473
474
}
@@ -571,7 +572,7 @@ fn main() {
571
572
572
573
// assert that we launch lintcheck from the repo root (via cargo lintcheck)
573
574
if std:: fs:: metadata ( "lintcheck/Cargo.toml" ) . is_err ( ) {
574
- eprintln ! ( "lintcheck needs to be run from clippy's repo root!\n Use `cargo lintcheck` alternatively." ) ;
575
+ error ! ( "lintcheck needs to be run from clippy's repo root!\n Use `cargo lintcheck` alternatively." ) ;
575
576
std:: process:: exit ( 3 ) ;
576
577
}
577
578
@@ -633,8 +634,8 @@ fn main() {
633
634
. collect ( ) ;
634
635
635
636
if crates. is_empty ( ) {
636
- eprintln ! (
637
- "ERROR: could not find crate '{}' in lintcheck/lintcheck_crates.toml" ,
637
+ error ! (
638
+ "could not find crate '{}' in lintcheck/lintcheck_crates.toml" ,
638
639
config. only. unwrap( ) ,
639
640
) ;
640
641
std:: process:: exit ( 1 ) ;
@@ -711,8 +712,7 @@ fn main() {
711
712
let _ = write ! ( text, "{cratename}: '{msg}'" ) ;
712
713
}
713
714
714
- println ! ( "Writing logs to {}" , config. lintcheck_results_path. display( ) ) ;
715
- fs:: create_dir_all ( config. lintcheck_results_path . parent ( ) . unwrap ( ) ) . unwrap ( ) ;
715
+ println ! ( "Writing results to {}" , config. lintcheck_results_path. display( ) ) ;
716
716
fs:: write ( & config. lintcheck_results_path , text) . unwrap ( ) ;
717
717
718
718
print_stats ( old_stats, new_stats, & config. lint_filter ) ;
0 commit comments