99
1010use std:: path:: PathBuf ;
1111use std:: process:: Command ;
12- use test_utils:: { CARGO_CLIPPY_PATH , IS_RUSTC_TEST_SUITE } ;
12+ use test_utils:: IS_RUSTC_TEST_SUITE ;
1313
1414mod test_utils;
1515
1616#[ test]
1717fn dogfood_clippy ( ) {
18- // run clippy on itself and fail the test if lint warnings are reported
19- if IS_RUSTC_TEST_SUITE {
20- return ;
21- }
22- let root_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
23-
24- let mut command = Command :: new ( & * CARGO_CLIPPY_PATH ) ;
25- command
26- . current_dir ( root_dir)
27- . env ( "CARGO_INCREMENTAL" , "0" )
28- . arg ( "clippy" )
29- . arg ( "--all-targets" )
30- . arg ( "--all-features" )
31- . arg ( "--" )
32- . args ( & [ "-D" , "clippy::all" ] )
33- . args ( & [ "-D" , "clippy::pedantic" ] )
34- . arg ( "-Cdebuginfo=0" ) ; // disable debuginfo to generate less data in the target dir
35-
36- // internal lints only exist if we build with the internal feature
37- if cfg ! ( feature = "internal" ) {
38- command. args ( & [ "-D" , "clippy::internal" ] ) ;
39- }
40-
41- let output = command. output ( ) . unwrap ( ) ;
42-
43- println ! ( "status: {}" , output. status) ;
44- println ! ( "stdout: {}" , String :: from_utf8_lossy( & output. stdout) ) ;
45- println ! ( "stderr: {}" , String :: from_utf8_lossy( & output. stderr) ) ;
46-
47- assert ! ( output. status. success( ) ) ;
48- }
49-
50- #[ test]
51- fn dogfood_subprojects ( ) {
52- // run clippy on remaining subprojects and fail the test if lint warnings are reported
5318 if IS_RUSTC_TEST_SUITE {
5419 return ;
5520 }
5621
57- // NOTE: `path_dep` crate is omitted on purpose here
58- for project in & [ "clippy_dev" , "clippy_lints" , "clippy_utils" , "rustc_tools_util" ] {
59- run_clippy_for_project ( project ) ;
22+ // "" is the root package
23+ for package in & [ "" , "clippy_dev" , "clippy_lints" , "clippy_utils" , "rustc_tools_util" ] {
24+ run_clippy_for_package ( package ) ;
6025 }
6126}
6227
@@ -73,7 +38,7 @@ fn run_metadata_collection_lint() {
7338
7439 // Run collection as is
7540 std:: env:: set_var ( "ENABLE_METADATA_COLLECTION" , "1" ) ;
76- run_clippy_for_project ( "clippy_lints" ) ;
41+ run_clippy_for_package ( "clippy_lints" ) ;
7742
7843 // Check if cargo caching got in the way
7944 if let Ok ( file) = File :: open ( metadata_output_path) {
@@ -96,10 +61,10 @@ fn run_metadata_collection_lint() {
9661 . unwrap ( ) ;
9762
9863 // Running the collection again
99- run_clippy_for_project ( "clippy_lints" ) ;
64+ run_clippy_for_package ( "clippy_lints" ) ;
10065}
10166
102- fn run_clippy_for_project ( project : & str ) {
67+ fn run_clippy_for_package ( project : & str ) {
10368 let root_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
10469
10570 let mut command = Command :: new ( & * test_utils:: CARGO_CLIPPY_PATH ) ;
0 commit comments