@@ -445,44 +445,40 @@ enum RlsStatus {
445
445
fn create_mock_dist_server ( path : & Path , s : Scenario ) {
446
446
let mut chans = Vec :: new ( ) ;
447
447
448
- let dates_count = match s {
449
- Scenario :: SimpleV1 | Scenario :: SimpleV2 | Scenario :: MultiHost => 1 ,
450
- Scenario :: Full
451
- | Scenario :: ArchivesV1
452
- | Scenario :: ArchivesV2
453
- | Scenario :: Unavailable
454
- | Scenario :: UnavailableRls => 2 ,
455
- Scenario :: MissingComponent => 3 ,
456
- } ;
457
-
458
448
if let Scenario :: MissingComponent = s {
459
- let c1 = build_mock_channel (
449
+ chans . push ( build_mock_channel (
460
450
s,
461
451
"nightly" ,
462
452
"2019-09-12" ,
463
453
"1.37.0" ,
464
454
"hash-n-1" ,
465
455
RlsStatus :: Available ,
466
- ) ;
467
- let c2 = build_mock_channel (
456
+ ) ) ;
457
+ chans . push ( build_mock_channel (
468
458
s,
469
459
"nightly" ,
470
460
"2019-09-13" ,
471
461
"1.37.0" ,
472
462
"hash-n-2" ,
473
463
RlsStatus :: Available ,
474
- ) ;
475
- let c3 = build_mock_channel (
464
+ ) ) ;
465
+ chans . push ( build_mock_channel (
476
466
s,
477
467
"nightly" ,
478
468
"2019-09-14" ,
479
469
"1.37.0" ,
480
470
"hash-n-3" ,
481
471
RlsStatus :: Unavailable ,
482
- ) ;
483
- chans. extend ( vec ! [ c1, c2, c3] ) ;
484
- } else if dates_count > 1 {
485
- let c1 = build_mock_channel (
472
+ ) ) ;
473
+ }
474
+
475
+ if let Scenario :: Full
476
+ | Scenario :: ArchivesV1
477
+ | Scenario :: ArchivesV2
478
+ | Scenario :: Unavailable
479
+ | Scenario :: UnavailableRls = s
480
+ {
481
+ chans. push ( build_mock_channel (
486
482
s,
487
483
"nightly" ,
488
484
"2015-01-01" ,
@@ -493,55 +489,60 @@ fn create_mock_dist_server(path: &Path, s: Scenario) {
493
489
} else {
494
490
RlsStatus :: Available
495
491
} ,
496
- ) ;
497
- let c2 = build_mock_channel (
492
+ ) ) ;
493
+ chans . push ( build_mock_channel (
498
494
s,
499
495
"beta" ,
500
496
"2015-01-01" ,
501
497
"1.1.0" ,
502
498
"hash-b-1" ,
503
499
RlsStatus :: Available ,
504
- ) ;
505
- let c3 = build_mock_channel (
500
+ ) ) ;
501
+ chans . push ( build_mock_channel (
506
502
s,
507
503
"stable" ,
508
504
"2015-01-01" ,
509
505
"1.0.0" ,
510
506
"hash-s-1" ,
511
507
RlsStatus :: Available ,
512
- ) ;
513
- chans. extend ( vec ! [ c1, c2, c3] ) ;
508
+ ) ) ;
514
509
}
510
+
515
511
if s != Scenario :: MissingComponent {
516
- let c4 = if s == Scenario :: Unavailable {
517
- build_mock_unavailable_channel ( "nightly" , "2015-01-02" , "1.3.0" , "hash-n-2" )
512
+ if s == Scenario :: Unavailable {
513
+ chans. push ( build_mock_unavailable_channel (
514
+ "nightly" ,
515
+ "2015-01-02" ,
516
+ "1.3.0" ,
517
+ "hash-n-2" ,
518
+ ) ) ;
518
519
} else {
519
- build_mock_channel (
520
+ chans . push ( build_mock_channel (
520
521
s,
521
522
"nightly" ,
522
523
"2015-01-02" ,
523
524
"1.3.0" ,
524
525
"hash-n-2" ,
525
526
RlsStatus :: Renamed ,
526
- )
527
- } ;
528
- let c5 = build_mock_channel (
527
+ ) ) ;
528
+ }
529
+
530
+ chans. push ( build_mock_channel (
529
531
s,
530
532
"beta" ,
531
533
"2015-01-02" ,
532
534
"1.2.0" ,
533
535
"hash-b-2" ,
534
536
RlsStatus :: Available ,
535
- ) ;
536
- let c6 = build_mock_channel (
537
+ ) ) ;
538
+ chans . push ( build_mock_channel (
537
539
s,
538
540
"stable" ,
539
541
"2015-01-02" ,
540
542
"1.1.0" ,
541
543
"hash-s-2" ,
542
544
RlsStatus :: Available ,
543
- ) ;
544
- chans. extend ( vec ! [ c4, c5, c6] ) ;
545
+ ) ) ;
545
546
}
546
547
547
548
let vs = match s {
@@ -561,18 +562,24 @@ fn create_mock_dist_server(path: &Path, s: Scenario) {
561
562
}
562
563
. write ( & vs, true ) ;
563
564
564
- if s != Scenario :: MissingComponent {
565
+ if let Scenario :: Full
566
+ | Scenario :: ArchivesV1
567
+ | Scenario :: ArchivesV2
568
+ | Scenario :: Unavailable
569
+ | Scenario :: UnavailableRls = s
570
+ {
565
571
// Also create the manifests for stable releases by version
566
- if dates_count > 1 {
567
- let _ = hard_link (
568
- path. join ( "dist/2015-01-01/channel-rust-stable.toml" ) ,
569
- path. join ( "dist/channel-rust-1.0.0.toml" ) ,
570
- ) ;
571
- let _ = hard_link (
572
- path. join ( "dist/2015-01-01/channel-rust-stable.toml.sha256" ) ,
573
- path. join ( "dist/channel-rust-1.0.0.toml.sha256" ) ,
574
- ) ;
575
- }
572
+ let _ = hard_link (
573
+ path. join ( "dist/2015-01-01/channel-rust-stable.toml" ) ,
574
+ path. join ( "dist/channel-rust-1.0.0.toml" ) ,
575
+ ) ;
576
+ let _ = hard_link (
577
+ path. join ( "dist/2015-01-01/channel-rust-stable.toml.sha256" ) ,
578
+ path. join ( "dist/channel-rust-1.0.0.toml.sha256" ) ,
579
+ ) ;
580
+ }
581
+
582
+ if s != Scenario :: MissingComponent {
576
583
let _ = hard_link (
577
584
path. join ( "dist/2015-01-02/channel-rust-stable.toml" ) ,
578
585
path. join ( "dist/channel-rust-1.1.0.toml" ) ,
@@ -581,27 +588,36 @@ fn create_mock_dist_server(path: &Path, s: Scenario) {
581
588
path. join ( "dist/2015-01-02/channel-rust-stable.toml.sha256" ) ,
582
589
path. join ( "dist/channel-rust-1.1.0.toml.sha256" ) ,
583
590
) ;
591
+ }
584
592
585
- // Same for v1 manifests. These are just the installers.
586
- let host_triple = this_host_triple ( ) ;
587
- if dates_count > 1 {
588
- hard_link (
589
- path. join ( format ! (
590
- "dist/2015-01-01/rust-stable-{}.tar.gz" ,
591
- host_triple
592
- ) ) ,
593
- path. join ( format ! ( "dist/rust-1.0.0-{}.tar.gz" , host_triple) ) ,
594
- )
595
- . unwrap ( ) ;
596
- hard_link (
597
- path. join ( format ! (
598
- "dist/2015-01-01/rust-stable-{}.tar.gz.sha256" ,
599
- host_triple
600
- ) ) ,
601
- path. join ( format ! ( "dist/rust-1.0.0-{}.tar.gz.sha256" , host_triple) ) ,
602
- )
603
- . unwrap ( ) ;
604
- }
593
+ // Same for v1 manifests. These are just the installers.
594
+ let host_triple = this_host_triple ( ) ;
595
+
596
+ if let Scenario :: Full
597
+ | Scenario :: ArchivesV1
598
+ | Scenario :: ArchivesV2
599
+ | Scenario :: Unavailable
600
+ | Scenario :: UnavailableRls = s
601
+ {
602
+ hard_link (
603
+ path. join ( format ! (
604
+ "dist/2015-01-01/rust-stable-{}.tar.gz" ,
605
+ host_triple
606
+ ) ) ,
607
+ path. join ( format ! ( "dist/rust-1.0.0-{}.tar.gz" , host_triple) ) ,
608
+ )
609
+ . unwrap ( ) ;
610
+ hard_link (
611
+ path. join ( format ! (
612
+ "dist/2015-01-01/rust-stable-{}.tar.gz.sha256" ,
613
+ host_triple
614
+ ) ) ,
615
+ path. join ( format ! ( "dist/rust-1.0.0-{}.tar.gz.sha256" , host_triple) ) ,
616
+ )
617
+ . unwrap ( ) ;
618
+ }
619
+
620
+ if s != Scenario :: MissingComponent {
605
621
hard_link (
606
622
path. join ( format ! (
607
623
"dist/2015-01-02/rust-stable-{}.tar.gz" ,
0 commit comments