@@ -523,7 +523,7 @@ fn print_lockfile_generation(
523523 if let Some ( note) = note {
524524 assert_eq ! ( change. kind, PackageChangeKind :: Added ) ;
525525 ws. gctx ( ) . shell ( ) . status_with_color (
526- "Adding" ,
526+ change . kind . status ( ) ,
527527 format ! ( "{package_id}{note}" ) ,
528528 & style:: NOTE ,
529529 ) ?;
@@ -579,11 +579,11 @@ fn print_lockfile_sync(
579579 if change. kind == PackageChangeKind :: Downgraded {
580580 ws. gctx ( )
581581 . shell ( )
582- . status_with_color ( "Downgrading" , msg, & style:: WARN ) ?;
582+ . status_with_color ( change . kind . status ( ) , msg, & style:: WARN ) ?;
583583 } else {
584584 ws. gctx ( )
585585 . shell ( )
586- . status_with_color ( "Updating" , msg, & style:: GOOD ) ?;
586+ . status_with_color ( change . kind . status ( ) , msg, & style:: GOOD ) ?;
587587 }
588588 } else {
589589 if change. kind == PackageChangeKind :: Added {
@@ -592,7 +592,7 @@ fn print_lockfile_sync(
592592 let note = required_rust_version. or ( latest) . unwrap_or_default ( ) ;
593593
594594 ws. gctx ( ) . shell ( ) . status_with_color (
595- "Adding" ,
595+ change . kind . status ( ) ,
596596 format ! ( "{package_id}{note}" ) ,
597597 & style:: NOTE ,
598598 ) ?;
@@ -649,16 +649,16 @@ fn print_lockfile_updates(
649649 if change. kind == PackageChangeKind :: Downgraded {
650650 ws. gctx ( )
651651 . shell ( )
652- . status_with_color ( "Downgrading" , msg, & style:: WARN ) ?;
652+ . status_with_color ( change . kind . status ( ) , msg, & style:: WARN ) ?;
653653 } else {
654654 ws. gctx ( )
655655 . shell ( )
656- . status_with_color ( "Updating" , msg, & style:: GOOD ) ?;
656+ . status_with_color ( change . kind . status ( ) , msg, & style:: GOOD ) ?;
657657 }
658658 } else {
659659 if change. kind == PackageChangeKind :: Removed {
660660 ws. gctx ( ) . shell ( ) . status_with_color (
661- "Removing" ,
661+ change . kind . status ( ) ,
662662 format ! ( "{package_id}" ) ,
663663 & style:: ERROR ,
664664 ) ?;
@@ -668,7 +668,7 @@ fn print_lockfile_updates(
668668 let note = required_rust_version. or ( latest) . unwrap_or_default ( ) ;
669669
670670 ws. gctx ( ) . shell ( ) . status_with_color (
671- "Adding" ,
671+ change . kind . status ( ) ,
672672 format ! ( "{package_id}{note}" ) ,
673673 & style:: NOTE ,
674674 ) ?;
@@ -685,7 +685,7 @@ fn print_lockfile_updates(
685685 }
686686 if ws. gctx ( ) . shell ( ) . verbosity ( ) == Verbosity :: Verbose {
687687 ws. gctx ( ) . shell ( ) . status_with_color (
688- "Unchanged" ,
688+ change . kind . status ( ) ,
689689 format ! ( "{package_id}{note}" ) ,
690690 & anstyle:: Style :: new ( ) . bold ( ) ,
691691 ) ?;
@@ -919,6 +919,16 @@ impl PackageChangeKind {
919919 Self :: Removed | Self :: Unchanged => false ,
920920 }
921921 }
922+
923+ pub fn status ( & self ) -> & ' static str {
924+ match self {
925+ Self :: Added => "Adding" ,
926+ Self :: Removed => "Removing" ,
927+ Self :: Upgraded => "Updating" ,
928+ Self :: Downgraded => "Downgrading" ,
929+ Self :: Unchanged => "Unchanged" ,
930+ }
931+ }
922932}
923933
924934/// All resolved versions of a package name within a [`SourceId`]
0 commit comments