@@ -214,12 +214,12 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) {
214
214
for ( name, license) in EXCEPTIONS {
215
215
// Check that the package actually exists.
216
216
if !metadata. packages . iter ( ) . any ( |p| p. name == * name) {
217
- println ! (
217
+ tidy_error ! (
218
+ bad,
218
219
"could not find exception package `{}`\n \
219
220
Remove from EXCEPTIONS list if it is no longer used.",
220
221
name
221
222
) ;
222
- * bad = true ;
223
223
}
224
224
// Check that the license hasn't changed.
225
225
for pkg in metadata. packages . iter ( ) . filter ( |p| p. name == * name) {
@@ -232,11 +232,11 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) {
232
232
}
233
233
match & pkg. license {
234
234
None => {
235
- println ! (
235
+ tidy_error ! (
236
+ bad,
236
237
"dependency exception `{}` does not declare a license expression" ,
237
238
pkg. id
238
239
) ;
239
- * bad = true ;
240
240
}
241
241
Some ( pkg_license) => {
242
242
if pkg_license. as_str ( ) != * license {
@@ -273,8 +273,7 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) {
273
273
let license = match & pkg. license {
274
274
Some ( license) => license,
275
275
None => {
276
- println ! ( "dependency `{}` does not define a license expression" , pkg. id, ) ;
277
- * bad = true ;
276
+ tidy_error ! ( bad, "dependency `{}` does not define a license expression" , pkg. id) ;
278
277
continue ;
279
278
}
280
279
} ;
@@ -286,8 +285,7 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) {
286
285
// general, these should never be added.
287
286
continue ;
288
287
}
289
- println ! ( "invalid license `{}` in `{}`" , license, pkg. id) ;
290
- * bad = true ;
288
+ tidy_error ! ( bad, "invalid license `{}` in `{}`" , license, pkg. id) ;
291
289
}
292
290
}
293
291
}
@@ -300,12 +298,12 @@ fn check_dependencies(metadata: &Metadata, bad: &mut bool) {
300
298
// Check that the PERMITTED_DEPENDENCIES does not have unused entries.
301
299
for name in PERMITTED_DEPENDENCIES {
302
300
if !metadata. packages . iter ( ) . any ( |p| p. name == * name) {
303
- println ! (
301
+ tidy_error ! (
302
+ bad,
304
303
"could not find allowed package `{}`\n \
305
304
Remove from PERMITTED_DEPENDENCIES list if it is no longer used.",
306
305
name
307
306
) ;
308
- * bad = true ;
309
307
}
310
308
}
311
309
// Get the list in a convenient form.
@@ -322,11 +320,10 @@ fn check_dependencies(metadata: &Metadata, bad: &mut bool) {
322
320
}
323
321
324
322
if !unapproved. is_empty ( ) {
325
- println ! ( "Dependencies not explicitly permitted:" ) ;
323
+ tidy_error ! ( bad , "Dependencies not explicitly permitted:" ) ;
326
324
for dep in unapproved {
327
325
println ! ( "* {}" , dep) ;
328
326
}
329
- * bad = true ;
330
327
}
331
328
}
332
329
@@ -381,16 +378,17 @@ fn check_crate_duplicate(metadata: &Metadata, bad: &mut bool) {
381
378
let matches: Vec < _ > = metadata. packages . iter ( ) . filter ( |pkg| pkg. name == name) . collect ( ) ;
382
379
match matches. len ( ) {
383
380
0 => {
384
- println ! (
381
+ tidy_error ! (
382
+ bad,
385
383
"crate `{}` is missing, update `check_crate_duplicate` \
386
384
if it is no longer used",
387
385
name
388
386
) ;
389
- * bad = true ;
390
387
}
391
388
1 => { }
392
389
_ => {
393
- println ! (
390
+ tidy_error ! (
391
+ bad,
394
392
"crate `{}` is duplicated in `Cargo.lock`, \
395
393
it is too expensive to build multiple times, \
396
394
so make sure only one version appears across all dependencies",
@@ -399,7 +397,6 @@ fn check_crate_duplicate(metadata: &Metadata, bad: &mut bool) {
399
397
for pkg in matches {
400
398
println ! ( " * {}" , pkg. id) ;
401
399
}
402
- * bad = true ;
403
400
}
404
401
}
405
402
}
0 commit comments