@@ -441,10 +441,7 @@ fn crate_version(
441441}
442442
443443fn indent ( spaces : usize ) {
444- print ! (
445- "{}" ,
446- vec![ 0 ; spaces] . iter( ) . map( |_| " " ) . collect:: <String >( )
447- ) ;
444+ print ! ( "{}" , " " . repeat( spaces) ) ;
448445}
449446
450447struct Section ( & ' static str ) ;
@@ -460,7 +457,7 @@ struct VersionBlock {
460457 version : String ,
461458 target_version : String ,
462459 indentation : usize ,
463- skip_update : bool ,
460+ skip_update_check : bool ,
464461}
465462
466463impl VersionBlock {
@@ -470,12 +467,12 @@ impl VersionBlock {
470467 version : version. into ( ) ,
471468 target_version : "" . into ( ) ,
472469 indentation : 2 ,
473- skip_update : false ,
470+ skip_update_check : false ,
474471 }
475472 }
476473
477- fn skip_update ( mut self ) -> Self {
478- self . skip_update = true ;
474+ fn skip_update_check ( mut self ) -> Self {
475+ self . skip_update_check = true ;
479476 self
480477 }
481478
@@ -497,12 +494,16 @@ impl VersionBlock {
497494 self . version. clone( )
498495 }
499496 ) ;
500- if !self . target_version . is_empty ( ) && !self . skip_update {
501- print ! (
502- "({}, latest: {})" ,
503- "outdated" . red( ) ,
504- self . target_version. green( )
505- ) ;
497+ if !self . target_version . is_empty ( ) && !self . skip_update_check {
498+ let version = semver:: Version :: parse ( self . version . as_str ( ) ) . unwrap ( ) ;
499+ let target_version = semver:: Version :: parse ( self . target_version . as_str ( ) ) . unwrap ( ) ;
500+ if version < target_version {
501+ print ! (
502+ "({}, latest: {})" ,
503+ "outdated" . red( ) ,
504+ self . target_version. green( )
505+ ) ;
506+ }
506507 }
507508 println ! ( ) ;
508509 }
@@ -592,7 +593,7 @@ pub fn command(_options: Options) -> Result<()> {
592593 . collect :: < String > ( ) ,
593594 )
594595 . target_version ( metadata. js_cli . node . replace ( ">= " , "" ) )
595- . skip_update ( )
596+ . skip_update_check ( )
596597 . display ( ) ;
597598
598599 VersionBlock :: new (
0 commit comments