@@ -946,24 +946,7 @@ fn print_dep_table_msg(shell: &mut Shell, dep: &DependencyUI) -> CargoResult<()>
946
946
let ( activated, deactivated) = dep. features ( ) ;
947
947
if !activated. is_empty ( ) || !deactivated. is_empty ( ) {
948
948
let prefix = format ! ( "{:>13}" , " " ) ;
949
- let suffix = if let Some ( version) = & dep. available_version {
950
- let mut version = version. clone ( ) ;
951
- version. build = Default :: default ( ) ;
952
- let version = version. to_string ( ) ;
953
- // Avoid displaying the version if it will visually look like the version req that we
954
- // showed earlier
955
- let version_req = dep
956
- . version ( )
957
- . and_then ( |v| semver:: VersionReq :: parse ( v) . ok ( ) )
958
- . and_then ( |v| precise_version ( & v) ) ;
959
- if version_req. as_deref ( ) != Some ( version. as_str ( ) ) {
960
- format ! ( " as of v{version}" )
961
- } else {
962
- "" . to_owned ( )
963
- }
964
- } else {
965
- "" . to_owned ( )
966
- } ;
949
+ let suffix = format_feature_version_suffix ( & dep) ;
967
950
968
951
shell. write_stderr ( format_args ! ( "{}Features{}:\n " , prefix, suffix) , & style:: NOP ) ?;
969
952
@@ -1009,6 +992,27 @@ fn print_dep_table_msg(shell: &mut Shell, dep: &DependencyUI) -> CargoResult<()>
1009
992
Ok ( ( ) )
1010
993
}
1011
994
995
+ fn format_feature_version_suffix ( dep : & DependencyUI ) -> String {
996
+ if let Some ( version) = & dep. available_version {
997
+ let mut version = version. clone ( ) ;
998
+ version. build = Default :: default ( ) ;
999
+ let version = version. to_string ( ) ;
1000
+ // Avoid displaying the version if it will visually look like the version req that we
1001
+ // showed earlier
1002
+ let version_req = dep
1003
+ . version ( )
1004
+ . and_then ( |v| semver:: VersionReq :: parse ( v) . ok ( ) )
1005
+ . and_then ( |v| precise_version ( & v) ) ;
1006
+ if version_req. as_deref ( ) != Some ( version. as_str ( ) ) {
1007
+ format ! ( " as of v{version}" )
1008
+ } else {
1009
+ "" . to_owned ( )
1010
+ }
1011
+ } else {
1012
+ "" . to_owned ( )
1013
+ }
1014
+ }
1015
+
1012
1016
// Based on Iterator::is_sorted from nightly std; remove in favor of that when stabilized.
1013
1017
fn is_sorted ( mut it : impl Iterator < Item = impl PartialOrd > ) -> bool {
1014
1018
let Some ( mut last) = it. next ( ) else {
0 commit comments