66#![ warn( rust_2018_idioms, unused_lifetimes) ]
77
88use itertools:: Itertools ;
9- use std:: fs:: File ;
109use std:: io:: { self , IsTerminal } ;
1110use std:: path:: PathBuf ;
1211use std:: process:: Command ;
13- use std:: time:: SystemTime ;
1412use test_utils:: IS_RUSTC_TEST_SUITE ;
1513use ui_test:: Args ;
1614
@@ -28,11 +26,7 @@ fn main() {
2826 println ! ( "dogfood: test" ) ;
2927 }
3028 } else if !args. skip . iter ( ) . any ( |arg| arg == "dogfood" ) {
31- if args. filters . iter ( ) . any ( |arg| arg == "collect_metadata" ) {
32- collect_metadata ( ) ;
33- } else {
34- dogfood ( ) ;
35- }
29+ dogfood ( ) ;
3630 }
3731}
3832
@@ -61,47 +55,6 @@ fn dogfood() {
6155 ) ;
6256}
6357
64- fn collect_metadata ( ) {
65- assert ! ( cfg!( feature = "internal" ) ) ;
66-
67- // Setup for validation
68- let metadata_output_path = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "util/gh-pages/lints.json" ) ;
69- let start_time = SystemTime :: now ( ) ;
70-
71- // Run collection as is
72- std:: env:: set_var ( "ENABLE_METADATA_COLLECTION" , "1" ) ;
73- assert ! ( run_clippy_for_package(
74- "clippy_lints" ,
75- & [ "-A" , "unfulfilled_lint_expectations" ]
76- ) ) ;
77-
78- // Check if cargo caching got in the way
79- if let Ok ( file) = File :: open ( metadata_output_path) {
80- if let Ok ( metadata) = file. metadata ( ) {
81- if let Ok ( last_modification) = metadata. modified ( ) {
82- if last_modification > start_time {
83- // The output file has been modified. Most likely by a hungry
84- // metadata collection monster. So We'll return.
85- return ;
86- }
87- }
88- }
89- }
90-
91- // Force cargo to invalidate the caches
92- filetime:: set_file_mtime (
93- PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "clippy_lints/src/lib.rs" ) ,
94- filetime:: FileTime :: now ( ) ,
95- )
96- . unwrap ( ) ;
97-
98- // Running the collection again
99- assert ! ( run_clippy_for_package(
100- "clippy_lints" ,
101- & [ "-A" , "unfulfilled_lint_expectations" ]
102- ) ) ;
103- }
104-
10558#[ must_use]
10659fn run_clippy_for_package ( project : & str , args : & [ & str ] ) -> bool {
10760 let root_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
0 commit comments