@@ -7,7 +7,7 @@ use std::path::Path;
7
7
use std:: str:: FromStr ;
8
8
9
9
use anyhow:: { anyhow, bail, Context , Result } ;
10
- use chrono:: { Date , NaiveDate , TimeZone , Utc } ;
10
+ use chrono:: NaiveDate ;
11
11
use lazy_static:: lazy_static;
12
12
use regex:: Regex ;
13
13
use thiserror:: Error as ThisError ;
@@ -734,9 +734,9 @@ fn update_from_dist_<'a>(
734
734
//
735
735
// We could arguably use the date of the first rustup release here, but that would break a
736
736
// bunch of the tests, which (inexplicably) use 2015-01-01 as their manifest dates.
737
- let first_manifest = Utc . from_utc_date ( & NaiveDate :: from_ymd ( 2014 , 12 , 20 ) ) ;
737
+ let first_manifest = date_from_manifest_date ( " 2014-12-20" ) . unwrap ( ) ;
738
738
let old_manifest = old_date
739
- . and_then ( utc_from_manifest_date )
739
+ . and_then ( date_from_manifest_date )
740
740
. unwrap_or ( first_manifest) ;
741
741
let last_manifest = if allow_downgrade {
742
742
first_manifest
@@ -808,9 +808,10 @@ fn update_from_dist_<'a>(
808
808
// nightlies in reverse chronological order until we find a nightly that does,
809
809
// starting at one date earlier than the current manifest's date.
810
810
let toolchain_date = toolchain. date . as_ref ( ) . unwrap_or ( & fetched) ;
811
- let try_next = utc_from_manifest_date ( toolchain_date)
811
+ let try_next = date_from_manifest_date ( toolchain_date)
812
812
. unwrap_or_else ( || panic ! ( "Malformed manifest date: {toolchain_date:?}" ) )
813
- . pred ( ) ;
813
+ . pred_opt ( )
814
+ . unwrap ( ) ;
814
815
815
816
if try_next < last_manifest {
816
817
// Wouldn't be an update if we go further back than the user's current nightly.
@@ -1071,10 +1072,8 @@ fn dl_v1_manifest(download: DownloadCfg<'_>, toolchain: &ToolchainDesc) -> Resul
1071
1072
Ok ( urls)
1072
1073
}
1073
1074
1074
- fn utc_from_manifest_date ( date_str : & str ) -> Option < Date < Utc > > {
1075
- NaiveDate :: parse_from_str ( date_str, "%Y-%m-%d" )
1076
- . ok ( )
1077
- . map ( |date| Utc . from_utc_date ( & date) )
1075
+ fn date_from_manifest_date ( date_str : & str ) -> Option < NaiveDate > {
1076
+ NaiveDate :: parse_from_str ( date_str, "%Y-%m-%d" ) . ok ( )
1078
1077
}
1079
1078
1080
1079
#[ cfg( test) ]
0 commit comments