@@ -13,8 +13,8 @@ use std::path::Path;
13
13
use crate :: controllers:: cargo_prelude:: * ;
14
14
use crate :: controllers:: util:: RequestPartsExt ;
15
15
use crate :: models:: {
16
- insert_version_owner_action, Category , Crate , DependencyKind , Keyword , NewCrate , NewVersion ,
17
- Rights , VersionAction ,
16
+ insert_version_owner_action, Category , Crate , Keyword , NewCrate , NewVersion , Rights ,
17
+ VersionAction ,
18
18
} ;
19
19
20
20
use crate :: middleware:: log_request:: RequestLogExt ;
@@ -198,8 +198,8 @@ pub async fn publish(app: AppState, req: BytesRequest) -> AppResult<Json<GoodCra
198
198
// to get here, and max upload sizes are way less than i32 max
199
199
content_length as i32 ,
200
200
user. id ,
201
- hex_cksum. clone ( ) ,
202
- links. clone ( ) ,
201
+ hex_cksum,
202
+ links,
203
203
) ?
204
204
. save ( conn, & verified_email_address) ?;
205
205
@@ -325,11 +325,11 @@ pub fn add_dependencies(
325
325
conn : & mut PgConnection ,
326
326
deps : & [ EncodableCrateDependency ] ,
327
327
target_version_id : i32 ,
328
- ) -> AppResult < Vec < cargo_registry_index :: Dependency > > {
328
+ ) -> AppResult < ( ) > {
329
329
use self :: dependencies:: dsl:: * ;
330
330
use diesel:: insert_into;
331
331
332
- let git_and_new_dependencies = deps
332
+ let new_dependencies = deps
333
333
. iter ( )
334
334
. map ( |dep| {
335
335
if let Some ( registry) = & dep. registry {
@@ -349,51 +349,25 @@ pub fn add_dependencies(
349
349
}
350
350
}
351
351
352
- // If this dependency has an explicit name in `Cargo.toml` that
353
- // means that the `name` we have listed is actually the package name
354
- // that we're depending on. The `name` listed in the index is the
355
- // Cargo.toml-written-name which is what cargo uses for
356
- // `--extern foo=...`
357
- let ( name, package) = match & dep. explicit_name_in_toml {
358
- Some ( explicit) => ( explicit. to_string ( ) , Some ( dep. name . to_string ( ) ) ) ,
359
- None => ( dep. name . to_string ( ) , None ) ,
360
- } ;
361
-
362
352
Ok ( (
363
- cargo_registry_index:: Dependency {
364
- name,
365
- req : dep. version_req . to_string ( ) ,
366
- features : dep. features . iter ( ) . map ( |s| s. 0 . to_string ( ) ) . collect ( ) ,
367
- optional : dep. optional ,
368
- default_features : dep. default_features ,
369
- target : dep. target . clone ( ) ,
370
- kind : dep. kind . or ( Some ( DependencyKind :: Normal ) ) . map ( |dk| dk. into ( ) ) ,
371
- package,
372
- } ,
373
- (
374
- version_id. eq ( target_version_id) ,
375
- crate_id. eq ( krate. id ) ,
376
- req. eq ( dep. version_req . to_string ( ) ) ,
377
- dep. kind . map ( |k| kind. eq ( k as i32 ) ) ,
378
- optional. eq ( dep. optional ) ,
379
- default_features. eq ( dep. default_features ) ,
380
- features. eq ( & dep. features ) ,
381
- target. eq ( dep. target . as_deref ( ) ) ,
382
- explicit_name. eq ( dep. explicit_name_in_toml . as_deref ( ) )
383
- ) ,
353
+ version_id. eq ( target_version_id) ,
354
+ crate_id. eq ( krate. id ) ,
355
+ req. eq ( dep. version_req . to_string ( ) ) ,
356
+ dep. kind . map ( |k| kind. eq ( k as i32 ) ) ,
357
+ optional. eq ( dep. optional ) ,
358
+ default_features. eq ( dep. default_features ) ,
359
+ features. eq ( & dep. features ) ,
360
+ target. eq ( dep. target . as_deref ( ) ) ,
361
+ explicit_name. eq ( dep. explicit_name_in_toml . as_deref ( ) )
384
362
) )
385
363
} )
386
364
. collect :: < Result < Vec < _ > , _ > > ( ) ?;
387
365
388
- let ( mut git_deps, new_dependencies) : ( Vec < _ > , Vec < _ > ) =
389
- git_and_new_dependencies. into_iter ( ) . unzip ( ) ;
390
- git_deps. sort ( ) ;
391
-
392
366
insert_into ( dependencies)
393
367
. values ( & new_dependencies)
394
368
. execute ( conn) ?;
395
369
396
- Ok ( git_deps )
370
+ Ok ( ( ) )
397
371
}
398
372
399
373
#[ instrument( skip_all, fields( %pkg_name) ) ]
0 commit comments