@@ -191,9 +191,9 @@ impl FromStr for Bound {
191
191
}
192
192
193
193
impl Bound {
194
- fn as_commit ( self ) -> Result < Self , Error > {
194
+ fn sha ( self ) -> Result < String , Error > {
195
195
match self {
196
- Bound :: Commit ( commit) => Ok ( Bound :: Commit ( commit) ) ,
196
+ Bound :: Commit ( commit) => Ok ( commit) ,
197
197
Bound :: Date ( date) => {
198
198
let date_str = date. format ( YYYY_MM_DD ) ;
199
199
let url = format ! ( "{}/{}/channel-rust-nightly-git-commit-hash.txt" , NIGHTLY_SERVER , date_str) ;
@@ -208,10 +208,14 @@ impl Bound {
208
208
209
209
eprintln ! ( "converted {} to {}" , date_str, commit) ;
210
210
211
- Ok ( Bound :: Commit ( commit) )
211
+ Ok ( commit)
212
212
}
213
213
}
214
214
}
215
+
216
+ fn as_commit ( self ) -> Result < Self , Error > {
217
+ self . sha ( ) . map ( Bound :: Commit )
218
+ }
215
219
}
216
220
217
221
impl Opts {
@@ -1028,19 +1032,17 @@ fn bisect(cfg: &Config, client: &Client) -> Result<(), Error> {
1028
1032
if let ToolchainSpec :: Nightly { date } = nightly_regression. spec {
1029
1033
let previous_date = date - chrono:: Duration :: days ( 1 ) ;
1030
1034
1031
- if let Bound :: Commit ( bad_commit) = Bound :: Date ( date) . as_commit ( ) ? {
1032
- if let Bound :: Commit ( working_commit) = Bound :: Date ( previous_date) . as_commit ( ) ? {
1033
- eprintln ! (
1034
- "looking for regression commit between {} and {}" ,
1035
- date. format( YYYY_MM_DD ) ,
1036
- previous_date. format( YYYY_MM_DD ) ,
1037
- ) ;
1038
-
1039
- let ci_bisection_result = bisect_ci_between ( cfg, client, & working_commit, & bad_commit) ?;
1040
- print_results ( cfg, client, & ci_bisection_result) ;
1041
- print_final_report ( & nightly_bisection_result, & ci_bisection_result) ;
1042
- }
1043
- }
1035
+ let bad_commit = Bound :: Date ( date) . sha ( ) ?;
1036
+ let working_commit = Bound :: Date ( previous_date) . sha ( ) ?;
1037
+ eprintln ! (
1038
+ "looking for regression commit between {} and {}" ,
1039
+ date. format( YYYY_MM_DD ) ,
1040
+ previous_date. format( YYYY_MM_DD ) ,
1041
+ ) ;
1042
+
1043
+ let ci_bisection_result = bisect_ci_between ( cfg, client, & working_commit, & bad_commit) ?;
1044
+ print_results ( cfg, client, & ci_bisection_result) ;
1045
+ print_final_report ( & nightly_bisection_result, & ci_bisection_result) ;
1044
1046
}
1045
1047
}
1046
1048
0 commit comments