@@ -214,12 +214,12 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) {
214214 for ( name, license) in EXCEPTIONS {
215215 // Check that the package actually exists.
216216 if !metadata. packages . iter ( ) . any ( |p| p. name == * name) {
217- println ! (
217+ tidy_error ! (
218+ bad,
218219 "could not find exception package `{}`\n \
219220 Remove from EXCEPTIONS list if it is no longer used.",
220221 name
221222 ) ;
222- * bad = true ;
223223 }
224224 // Check that the license hasn't changed.
225225 for pkg in metadata. packages . iter ( ) . filter ( |p| p. name == * name) {
@@ -232,11 +232,11 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) {
232232 }
233233 match & pkg. license {
234234 None => {
235- println ! (
235+ tidy_error ! (
236+ bad,
236237 "dependency exception `{}` does not declare a license expression" ,
237238 pkg. id
238239 ) ;
239- * bad = true ;
240240 }
241241 Some ( pkg_license) => {
242242 if pkg_license. as_str ( ) != * license {
@@ -273,8 +273,7 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) {
273273 let license = match & pkg. license {
274274 Some ( license) => license,
275275 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) ;
278277 continue ;
279278 }
280279 } ;
@@ -286,8 +285,7 @@ fn check_exceptions(metadata: &Metadata, bad: &mut bool) {
286285 // general, these should never be added.
287286 continue ;
288287 }
289- println ! ( "invalid license `{}` in `{}`" , license, pkg. id) ;
290- * bad = true ;
288+ tidy_error ! ( bad, "invalid license `{}` in `{}`" , license, pkg. id) ;
291289 }
292290 }
293291}
@@ -300,12 +298,12 @@ fn check_dependencies(metadata: &Metadata, bad: &mut bool) {
300298 // Check that the PERMITTED_DEPENDENCIES does not have unused entries.
301299 for name in PERMITTED_DEPENDENCIES {
302300 if !metadata. packages . iter ( ) . any ( |p| p. name == * name) {
303- println ! (
301+ tidy_error ! (
302+ bad,
304303 "could not find allowed package `{}`\n \
305304 Remove from PERMITTED_DEPENDENCIES list if it is no longer used.",
306305 name
307306 ) ;
308- * bad = true ;
309307 }
310308 }
311309 // Get the list in a convenient form.
@@ -322,11 +320,10 @@ fn check_dependencies(metadata: &Metadata, bad: &mut bool) {
322320 }
323321
324322 if !unapproved. is_empty ( ) {
325- println ! ( "Dependencies not explicitly permitted:" ) ;
323+ tidy_error ! ( bad , "Dependencies not explicitly permitted:" ) ;
326324 for dep in unapproved {
327325 println ! ( "* {}" , dep) ;
328326 }
329- * bad = true ;
330327 }
331328}
332329
@@ -381,16 +378,17 @@ fn check_crate_duplicate(metadata: &Metadata, bad: &mut bool) {
381378 let matches: Vec < _ > = metadata. packages . iter ( ) . filter ( |pkg| pkg. name == name) . collect ( ) ;
382379 match matches. len ( ) {
383380 0 => {
384- println ! (
381+ tidy_error ! (
382+ bad,
385383 "crate `{}` is missing, update `check_crate_duplicate` \
386384 if it is no longer used",
387385 name
388386 ) ;
389- * bad = true ;
390387 }
391388 1 => { }
392389 _ => {
393- println ! (
390+ tidy_error ! (
391+ bad,
394392 "crate `{}` is duplicated in `Cargo.lock`, \
395393 it is too expensive to build multiple times, \
396394 so make sure only one version appears across all dependencies",
@@ -399,7 +397,6 @@ fn check_crate_duplicate(metadata: &Metadata, bad: &mut bool) {
399397 for pkg in matches {
400398 println ! ( " * {}" , pkg. id) ;
401399 }
402- * bad = true ;
403400 }
404401 }
405402 }
0 commit comments