File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,24 @@ impl TryFrom<&'_ PackageId> for Crate {
114114 }
115115 }
116116 }
117+ [ "registry" , url, ..] => {
118+ let Some ( ( _registry, krate) ) = url. split_once ( '#' ) else {
119+ bail ! (
120+ "malformed pkgid format: {}\n maybe the representation has changed?" ,
121+ pkgid. repr
122+ ) ;
123+ } ;
124+ let Some ( ( crate_name, crate_version) ) = krate. split_once ( '@' ) else {
125+ bail ! (
126+ "malformed pkgid format: {}\n maybe the representation has changed?" ,
127+ pkgid. repr
128+ ) ;
129+ } ;
130+ Ok ( Crate :: Registry ( RegistryCrate {
131+ name : crate_name. to_string ( ) ,
132+ version : crate_version. to_string ( ) ,
133+ } ) )
134+ }
117135 _ => bail ! (
118136 "malformed pkgid format: {}\n maybe the representation has changed?" ,
119137 pkgid. repr
@@ -252,7 +270,7 @@ mod tests {
252270 . to_string( ) ,
253271 sha: None
254272 } ) ,
255- "registry+https://github.com/rust-lang/crates.io-index#[email protected] " =>
Crate :: Registry ( RegistryCrate { 273+ "registry+https://github.com/rust-lang/crates.io-index#[email protected] " =>
Crate :: Registry ( RegistryCrate { 256274 name: "cookie" . to_string( ) ,
257275 version: "0.15.0" . to_string( ) ,
258276 } ) ,
You can’t perform that action at this time.
0 commit comments