@@ -22,14 +22,12 @@ fn dogfood_clippy() {
22
22
return ;
23
23
}
24
24
let root_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
25
- let enable_metadata_collection = std:: env:: var ( "ENABLE_METADATA_COLLECTION" ) . unwrap_or_else ( |_| "0" . to_string ( ) ) ;
26
25
27
26
let mut command = Command :: new ( & * CLIPPY_PATH ) ;
28
27
command
29
28
. current_dir ( root_dir)
30
29
. env ( "CLIPPY_DOGFOOD" , "1" )
31
30
. env ( "CARGO_INCREMENTAL" , "0" )
32
- . env ( "ENABLE_METADATA_COLLECTION" , & enable_metadata_collection)
33
31
. arg ( "clippy" )
34
32
. arg ( "--all-targets" )
35
33
. arg ( "--all-features" )
@@ -157,10 +155,9 @@ fn dogfood_subprojects() {
157
155
if cargo:: is_rustc_test_suite ( ) {
158
156
return ;
159
157
}
160
- let root_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
161
158
162
159
// NOTE: `path_dep` crate is omitted on purpose here
163
- for d in & [
160
+ for project in & [
164
161
"clippy_workspace_tests" ,
165
162
"clippy_workspace_tests/src" ,
166
163
"clippy_workspace_tests/subcrate" ,
@@ -170,34 +167,49 @@ fn dogfood_subprojects() {
170
167
"clippy_utils" ,
171
168
"rustc_tools_util" ,
172
169
] {
173
- let mut command = Command :: new ( & * CLIPPY_PATH ) ;
174
- command
175
- . current_dir ( root_dir. join ( d) )
176
- . env ( "CLIPPY_DOGFOOD" , "1" )
177
- . env ( "CARGO_INCREMENTAL" , "0" )
178
- . arg ( "clippy" )
179
- . arg ( "--all-targets" )
180
- . arg ( "--all-features" )
181
- . arg ( "--" )
182
- . args ( & [ "-D" , "clippy::all" ] )
183
- . args ( & [ "-D" , "clippy::pedantic" ] )
184
- . arg ( "-Cdebuginfo=0" ) ; // disable debuginfo to generate less data in the target dir
170
+ run_clippy_for_project ( project) ;
171
+ }
172
+
173
+ // NOTE: Since tests run in parallel we can't run cargo commands on the same workspace at the
174
+ // same time, so we test this immediately after the dogfood for workspaces.
175
+ test_no_deps_ignores_path_deps_in_workspaces ( ) ;
176
+ }
185
177
186
- // internal lints only exist if we build with the internal-lints feature
187
- if cfg ! ( feature = "internal-lints" ) {
188
- command. args ( & [ "-D" , "clippy::internal" ] ) ;
189
- }
178
+ #[ test]
179
+ #[ ignore]
180
+ #[ cfg( feature = "metadata-collector-lint" ) ]
181
+ fn run_metadata_collection_lint ( ) {
182
+ std:: env:: set_var ( "ENABLE_METADATA_COLLECTION" , "1" ) ;
183
+ run_clippy_for_project ( "clippy_lints" ) ;
184
+ }
190
185
191
- let output = command. output ( ) . unwrap ( ) ;
186
+ fn run_clippy_for_project ( project : & str ) {
187
+ let root_dir = PathBuf :: from ( env ! ( "CARGO_MANIFEST_DIR" ) ) ;
192
188
193
- println ! ( "status: {}" , output. status) ;
194
- println ! ( "stdout: {}" , String :: from_utf8_lossy( & output. stdout) ) ;
195
- println ! ( "stderr: {}" , String :: from_utf8_lossy( & output. stderr) ) ;
189
+ let mut command = Command :: new ( & * CLIPPY_PATH ) ;
196
190
197
- assert ! ( output. status. success( ) ) ;
191
+ command
192
+ . current_dir ( root_dir. join ( project) )
193
+ . env ( "CLIPPY_DOGFOOD" , "1" )
194
+ . env ( "CARGO_INCREMENTAL" , "0" )
195
+ . arg ( "clippy" )
196
+ . arg ( "--all-targets" )
197
+ . arg ( "--all-features" )
198
+ . arg ( "--" )
199
+ . args ( & [ "-D" , "clippy::all" ] )
200
+ . args ( & [ "-D" , "clippy::pedantic" ] )
201
+ . arg ( "-Cdebuginfo=0" ) ; // disable debuginfo to generate less data in the target dir
202
+
203
+ // internal lints only exist if we build with the internal-lints feature
204
+ if cfg ! ( feature = "internal-lints" ) {
205
+ command. args ( & [ "-D" , "clippy::internal" ] ) ;
198
206
}
199
207
200
- // NOTE: Since tests run in parallel we can't run cargo commands on the same workspace at the
201
- // same time, so we test this immediately after the dogfood for workspaces.
202
- test_no_deps_ignores_path_deps_in_workspaces ( ) ;
208
+ let output = command. output ( ) . unwrap ( ) ;
209
+
210
+ println ! ( "status: {}" , output. status) ;
211
+ println ! ( "stdout: {}" , String :: from_utf8_lossy( & output. stdout) ) ;
212
+ println ! ( "stderr: {}" , String :: from_utf8_lossy( & output. stderr) ) ;
213
+
214
+ assert ! ( output. status. success( ) ) ;
203
215
}
0 commit comments