@@ -525,7 +525,7 @@ fn print_lockfile_generation(
525
525
ws. gctx ( ) . shell ( ) . status_with_color (
526
526
change. kind . status ( ) ,
527
527
format ! ( "{package_id}{note}" ) ,
528
- & style:: NOTE ,
528
+ & change . kind . style ( ) ,
529
529
) ?;
530
530
}
531
531
}
@@ -577,13 +577,17 @@ fn print_lockfile_sync(
577
577
} ;
578
578
579
579
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
+ ) ?;
583
585
} 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
+ ) ?;
587
591
}
588
592
} else {
589
593
if change. kind == PackageChangeKind :: Added {
@@ -594,7 +598,7 @@ fn print_lockfile_sync(
594
598
ws. gctx ( ) . shell ( ) . status_with_color (
595
599
change. kind . status ( ) ,
596
600
format ! ( "{package_id}{note}" ) ,
597
- & style:: NOTE ,
601
+ & change . kind . style ( ) ,
598
602
) ?;
599
603
}
600
604
}
@@ -647,20 +651,24 @@ fn print_lockfile_updates(
647
651
} ;
648
652
649
653
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
+ ) ?;
653
659
} 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
+ ) ?;
657
665
}
658
666
} else {
659
667
if change. kind == PackageChangeKind :: Removed {
660
668
ws. gctx ( ) . shell ( ) . status_with_color (
661
669
change. kind . status ( ) ,
662
670
format ! ( "{package_id}" ) ,
663
- & style:: ERROR ,
671
+ & change . kind . style ( ) ,
664
672
) ?;
665
673
} else if change. kind == PackageChangeKind :: Added {
666
674
let required_rust_version = report_required_rust_version ( ws, resolve, package_id) ;
@@ -670,7 +678,7 @@ fn print_lockfile_updates(
670
678
ws. gctx ( ) . shell ( ) . status_with_color (
671
679
change. kind . status ( ) ,
672
680
format ! ( "{package_id}{note}" ) ,
673
- & style:: NOTE ,
681
+ & change . kind . style ( ) ,
674
682
) ?;
675
683
}
676
684
}
@@ -687,7 +695,7 @@ fn print_lockfile_updates(
687
695
ws. gctx ( ) . shell ( ) . status_with_color (
688
696
change. kind . status ( ) ,
689
697
format ! ( "{package_id}{note}" ) ,
690
- & anstyle :: Style :: new ( ) . bold ( ) ,
698
+ & change . kind . style ( ) ,
691
699
) ?;
692
700
}
693
701
}
@@ -929,6 +937,16 @@ impl PackageChangeKind {
929
937
Self :: Unchanged => "Unchanged" ,
930
938
}
931
939
}
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
+ }
932
950
}
933
951
934
952
/// All resolved versions of a package name within a [`SourceId`]
0 commit comments