@@ -7,7 +7,7 @@ use std::path::Path;
77use std:: str:: FromStr ;
88
99use anyhow:: { anyhow, bail, Context , Result } ;
10- use chrono:: { Date , NaiveDate , TimeZone , Utc } ;
10+ use chrono:: NaiveDate ;
1111use lazy_static:: lazy_static;
1212use regex:: Regex ;
1313use thiserror:: Error as ThisError ;
@@ -734,9 +734,9 @@ fn update_from_dist_<'a>(
734734 //
735735 // We could arguably use the date of the first rustup release here, but that would break a
736736 // 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 ( ) ;
738738 let old_manifest = old_date
739- . and_then ( utc_from_manifest_date )
739+ . and_then ( date_from_manifest_date )
740740 . unwrap_or ( first_manifest) ;
741741 let last_manifest = if allow_downgrade {
742742 first_manifest
@@ -808,9 +808,10 @@ fn update_from_dist_<'a>(
808808 // nightlies in reverse chronological order until we find a nightly that does,
809809 // starting at one date earlier than the current manifest's date.
810810 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)
812812 . unwrap_or_else ( || panic ! ( "Malformed manifest date: {toolchain_date:?}" ) )
813- . pred ( ) ;
813+ . pred_opt ( )
814+ . unwrap ( ) ;
814815
815816 if try_next < last_manifest {
816817 // 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
10711072 Ok ( urls)
10721073}
10731074
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 ( )
10781077}
10791078
10801079#[ cfg( test) ]
0 commit comments