File tree 1 file changed +3
-21
lines changed
src/cargo/sources/registry
1 file changed +3
-21
lines changed Original file line number Diff line number Diff line change @@ -1013,26 +1013,8 @@ fn max_unpack_size(config: &Config, size: u64) -> u64 {
1013
1013
u64:: max ( max_unpack_size, size * max_compression_ratio as u64 )
1014
1014
}
1015
1015
1016
+ /// Constructs a path to a dependency in the registry index on filesystem.
1017
+ /// See [`cargo_util::registry::make_dep_path`] for more.
1016
1018
fn make_dep_prefix ( name : & str ) -> String {
1017
- match name. len ( ) {
1018
- 1 => String :: from ( "1" ) ,
1019
- 2 => String :: from ( "2" ) ,
1020
- 3 => format ! ( "3/{}" , & name[ ..1 ] ) ,
1021
- _ => format ! ( "{}/{}" , & name[ 0 ..2 ] , & name[ 2 ..4 ] ) ,
1022
- }
1023
- }
1024
-
1025
- #[ cfg( test) ]
1026
- mod tests {
1027
- use super :: make_dep_prefix;
1028
-
1029
- #[ test]
1030
- fn dep_prefix ( ) {
1031
- assert_eq ! ( make_dep_prefix( "a" ) , "1" ) ;
1032
- assert_eq ! ( make_dep_prefix( "ab" ) , "2" ) ;
1033
- assert_eq ! ( make_dep_prefix( "abc" ) , "3/a" ) ;
1034
- assert_eq ! ( make_dep_prefix( "Abc" ) , "3/A" ) ;
1035
- assert_eq ! ( make_dep_prefix( "AbCd" ) , "Ab/Cd" ) ;
1036
- assert_eq ! ( make_dep_prefix( "aBcDe" ) , "aB/cD" ) ;
1037
- }
1019
+ cargo_util:: registry:: make_dep_path ( name, true )
1038
1020
}
You can’t perform that action at this time.
0 commit comments