@@ -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
@@ -324,11 +324,11 @@ pub fn add_dependencies(
324
324
conn : & mut PgConnection ,
325
325
deps : & [ EncodableCrateDependency ] ,
326
326
target_version_id : i32 ,
327
- ) -> AppResult < Vec < cargo_registry_index :: Dependency > > {
327
+ ) -> AppResult < ( ) > {
328
328
use self :: dependencies:: dsl:: * ;
329
329
use diesel:: insert_into;
330
330
331
- let git_and_new_dependencies = deps
331
+ let new_dependencies = deps
332
332
. iter ( )
333
333
. map ( |dep| {
334
334
if let Some ( registry) = & dep. registry {
@@ -348,51 +348,25 @@ pub fn add_dependencies(
348
348
}
349
349
}
350
350
351
- // If this dependency has an explicit name in `Cargo.toml` that
352
- // means that the `name` we have listed is actually the package name
353
- // that we're depending on. The `name` listed in the index is the
354
- // Cargo.toml-written-name which is what cargo uses for
355
- // `--extern foo=...`
356
- let ( name, package) = match & dep. explicit_name_in_toml {
357
- Some ( explicit) => ( explicit. to_string ( ) , Some ( dep. name . to_string ( ) ) ) ,
358
- None => ( dep. name . to_string ( ) , None ) ,
359
- } ;
360
-
361
351
Ok ( (
362
- cargo_registry_index:: Dependency {
363
- name,
364
- req : dep. version_req . to_string ( ) ,
365
- features : dep. features . iter ( ) . map ( |s| s. 0 . to_string ( ) ) . collect ( ) ,
366
- optional : dep. optional ,
367
- default_features : dep. default_features ,
368
- target : dep. target . clone ( ) ,
369
- kind : dep. kind . or ( Some ( DependencyKind :: Normal ) ) . map ( |dk| dk. into ( ) ) ,
370
- package,
371
- } ,
372
- (
373
- version_id. eq ( target_version_id) ,
374
- crate_id. eq ( krate. id ) ,
375
- req. eq ( dep. version_req . to_string ( ) ) ,
376
- dep. kind . map ( |k| kind. eq ( k as i32 ) ) ,
377
- optional. eq ( dep. optional ) ,
378
- default_features. eq ( dep. default_features ) ,
379
- features. eq ( & dep. features ) ,
380
- target. eq ( dep. target . as_deref ( ) ) ,
381
- explicit_name. eq ( dep. explicit_name_in_toml . as_deref ( ) )
382
- ) ,
352
+ version_id. eq ( target_version_id) ,
353
+ crate_id. eq ( krate. id ) ,
354
+ req. eq ( dep. version_req . to_string ( ) ) ,
355
+ dep. kind . map ( |k| kind. eq ( k as i32 ) ) ,
356
+ optional. eq ( dep. optional ) ,
357
+ default_features. eq ( dep. default_features ) ,
358
+ features. eq ( & dep. features ) ,
359
+ target. eq ( dep. target . as_deref ( ) ) ,
360
+ explicit_name. eq ( dep. explicit_name_in_toml . as_deref ( ) )
383
361
) )
384
362
} )
385
363
. collect :: < Result < Vec < _ > , _ > > ( ) ?;
386
364
387
- let ( mut git_deps, new_dependencies) : ( Vec < _ > , Vec < _ > ) =
388
- git_and_new_dependencies. into_iter ( ) . unzip ( ) ;
389
- git_deps. sort ( ) ;
390
-
391
365
insert_into ( dependencies)
392
366
. values ( & new_dependencies)
393
367
. execute ( conn) ?;
394
368
395
- Ok ( git_deps )
369
+ Ok ( ( ) )
396
370
}
397
371
398
372
fn verify_tarball (
0 commit comments