@@ -525,7 +525,7 @@ fn print_lockfile_generation(
525525 ws. gctx ( ) . shell ( ) . status_with_color (
526526 change. kind . status ( ) ,
527527 format ! ( "{package_id}{note}" ) ,
528- & style:: NOTE ,
528+ & change . kind . style ( ) ,
529529 ) ?;
530530 }
531531 }
@@ -577,13 +577,17 @@ fn print_lockfile_sync(
577577 } ;
578578
579579 if change. kind == PackageChangeKind :: Downgraded {
580- ws. gctx ( )
581- . shell ( )
582- . status_with_color ( change. kind . status ( ) , msg, & style:: WARN ) ?;
580+ ws. gctx ( ) . shell ( ) . status_with_color (
581+ change. kind . status ( ) ,
582+ msg,
583+ & change. kind . style ( ) ,
584+ ) ?;
583585 } else {
584- ws. gctx ( )
585- . shell ( )
586- . status_with_color ( change. kind . status ( ) , msg, & style:: GOOD ) ?;
586+ ws. gctx ( ) . shell ( ) . status_with_color (
587+ change. kind . status ( ) ,
588+ msg,
589+ & change. kind . style ( ) ,
590+ ) ?;
587591 }
588592 } else {
589593 if change. kind == PackageChangeKind :: Added {
@@ -594,7 +598,7 @@ fn print_lockfile_sync(
594598 ws. gctx ( ) . shell ( ) . status_with_color (
595599 change. kind . status ( ) ,
596600 format ! ( "{package_id}{note}" ) ,
597- & style:: NOTE ,
601+ & change . kind . style ( ) ,
598602 ) ?;
599603 }
600604 }
@@ -647,20 +651,24 @@ fn print_lockfile_updates(
647651 } ;
648652
649653 if change. kind == PackageChangeKind :: Downgraded {
650- ws. gctx ( )
651- . shell ( )
652- . status_with_color ( change. kind . status ( ) , msg, & style:: WARN ) ?;
654+ ws. gctx ( ) . shell ( ) . status_with_color (
655+ change. kind . status ( ) ,
656+ msg,
657+ & change. kind . style ( ) ,
658+ ) ?;
653659 } else {
654- ws. gctx ( )
655- . shell ( )
656- . status_with_color ( change. kind . status ( ) , msg, & style:: GOOD ) ?;
660+ ws. gctx ( ) . shell ( ) . status_with_color (
661+ change. kind . status ( ) ,
662+ msg,
663+ & change. kind . style ( ) ,
664+ ) ?;
657665 }
658666 } else {
659667 if change. kind == PackageChangeKind :: Removed {
660668 ws. gctx ( ) . shell ( ) . status_with_color (
661669 change. kind . status ( ) ,
662670 format ! ( "{package_id}" ) ,
663- & style:: ERROR ,
671+ & change . kind . style ( ) ,
664672 ) ?;
665673 } else if change. kind == PackageChangeKind :: Added {
666674 let required_rust_version = report_required_rust_version ( ws, resolve, package_id) ;
@@ -670,7 +678,7 @@ fn print_lockfile_updates(
670678 ws. gctx ( ) . shell ( ) . status_with_color (
671679 change. kind . status ( ) ,
672680 format ! ( "{package_id}{note}" ) ,
673- & style:: NOTE ,
681+ & change . kind . style ( ) ,
674682 ) ?;
675683 }
676684 }
@@ -687,7 +695,7 @@ fn print_lockfile_updates(
687695 ws. gctx ( ) . shell ( ) . status_with_color (
688696 change. kind . status ( ) ,
689697 format ! ( "{package_id}{note}" ) ,
690- & anstyle :: Style :: new ( ) . bold ( ) ,
698+ & change . kind . style ( ) ,
691699 ) ?;
692700 }
693701 }
@@ -929,6 +937,16 @@ impl PackageChangeKind {
929937 Self :: Unchanged => "Unchanged" ,
930938 }
931939 }
940+
941+ pub fn style ( & self ) -> anstyle:: Style {
942+ match self {
943+ Self :: Added => style:: NOTE ,
944+ Self :: Removed => style:: ERROR ,
945+ Self :: Upgraded => style:: GOOD ,
946+ Self :: Downgraded => style:: WARN ,
947+ Self :: Unchanged => anstyle:: Style :: new ( ) . bold ( ) ,
948+ }
949+ }
932950}
933951
934952/// All resolved versions of a package name within a [`SourceId`]
0 commit comments