@@ -178,10 +178,12 @@ enum Bound {
178
178
#[ fail( display = "will never happen" ) ]
179
179
struct BoundParseError { }
180
180
181
+ const YYYY_MM_DD : & ' static str = "%Y-%m-%d" ;
182
+
181
183
impl FromStr for Bound {
182
184
type Err = BoundParseError ;
183
185
fn from_str ( s : & str ) -> Result < Bound , BoundParseError > {
184
- match chrono:: NaiveDate :: parse_from_str ( s, "%Y-%m-%d" ) {
186
+ match chrono:: NaiveDate :: parse_from_str ( s, YYYY_MM_DD ) {
185
187
Ok ( date) => Ok ( Bound :: Date ( Date :: from_utc ( date, Utc ) ) ) ,
186
188
Err ( _) => Ok ( Bound :: Commit ( s. to_string ( ) ) ) ,
187
189
}
@@ -193,7 +195,7 @@ impl Bound {
193
195
match self {
194
196
Bound :: Commit ( commit) => Ok ( Bound :: Commit ( commit) ) ,
195
197
Bound :: Date ( date) => {
196
- let date_str = date. format ( "%Y-%m-%d" ) ;
198
+ let date_str = date. format ( YYYY_MM_DD ) ;
197
199
let url = format ! ( "{}/{}/channel-rust-nightly-git-commit-hash.txt" , NIGHTLY_SERVER , date_str) ;
198
200
199
201
eprintln ! ( "fetching {}" , url) ;
@@ -262,7 +264,7 @@ impl Toolchain {
262
264
// N.B. We need to call this with a nonstandard name so that rustup utilizes the
263
265
// fallback cargo logic.
264
266
ToolchainSpec :: Nightly { ref date } => {
265
- format ! ( "bisector-nightly-{}-{}" , date. format( "%Y-%m-%d" ) , self . host)
267
+ format ! ( "bisector-nightly-{}-{}" , date. format( YYYY_MM_DD ) , self . host)
266
268
}
267
269
}
268
270
}
@@ -275,7 +277,7 @@ impl fmt::Display for Toolchain {
275
277
let alt_s = if alt { format ! ( "-alt" ) } else { String :: new ( ) } ;
276
278
write ! ( f, "{}{}" , commit, alt_s)
277
279
}
278
- ToolchainSpec :: Nightly { ref date } => write ! ( f, "nightly-{}" , date. format( "%Y-%m-%d" ) ) ,
280
+ ToolchainSpec :: Nightly { ref date } => write ! ( f, "nightly-{}" , date. format( YYYY_MM_DD ) ) ,
279
281
}
280
282
}
281
283
}
@@ -753,7 +755,7 @@ impl Toolchain {
753
755
754
756
let location = match self . spec {
755
757
ToolchainSpec :: Ci { ref commit, .. } => commit. to_string ( ) ,
756
- ToolchainSpec :: Nightly { ref date } => date. format ( "%Y-%m-%d" ) . to_string ( ) ,
758
+ ToolchainSpec :: Nightly { ref date } => date. format ( YYYY_MM_DD ) . to_string ( ) ,
757
759
} ;
758
760
759
761
// download rustc.
@@ -1030,8 +1032,8 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
1030
1032
if let Bound :: Commit ( working_commit) = Bound :: Date ( previous_date) . as_commit ( ) ? {
1031
1033
eprintln ! (
1032
1034
"looking for regression commit between {} and {}" ,
1033
- date. format( "%Y-%m-%d" ) ,
1034
- previous_date. format( "%Y-%m-%d" ) ,
1035
+ date. format( YYYY_MM_DD ) ,
1036
+ previous_date. format( YYYY_MM_DD ) ,
1035
1037
) ;
1036
1038
1037
1039
let ci_bisection_result = bisect_ci_between ( cfg, client, & working_commit, & bad_commit) ?;
0 commit comments