@@ -15,24 +15,33 @@ pub use self_profile::{QueryData, SelfProfile};
15
15
#[ derive( Debug , Copy , Clone , PartialEq , PartialOrd , Deserialize ) ]
16
16
pub struct DeltaTime ( #[ serde( with = "round_float" ) ] pub f64 ) ;
17
17
18
+ /// The bound of a range changes in codebase
19
+ ///
20
+ /// This can either be the upper or lower bound
18
21
#[ derive( Debug , Clone , PartialEq , Eq ) ]
19
22
pub enum Bound {
20
- // sha, unverified
23
+ /// An unverified git commit (in sha form)
21
24
Commit ( String ) ,
25
+ /// A date in time
22
26
Date ( NaiveDate ) ,
27
+ /// No bound
23
28
None ,
24
29
}
25
30
26
31
impl Bound {
32
+ /// Tests whether self bounds the commit to the left
27
33
pub fn left_match ( & self , commit : & Commit ) -> bool {
28
- let last_month = chrono:: Utc :: now ( ) . date ( ) . naive_utc ( ) - chrono:: Duration :: days ( 30 ) ;
29
34
match self {
30
35
Bound :: Commit ( sha) => commit. sha == * * sha,
31
36
Bound :: Date ( date) => commit. date . 0 . naive_utc ( ) . date ( ) >= * date,
32
- Bound :: None => last_month <= commit. date . 0 . naive_utc ( ) . date ( ) ,
37
+ Bound :: None => {
38
+ let last_month = chrono:: Utc :: now ( ) . date ( ) . naive_utc ( ) - chrono:: Duration :: days ( 30 ) ;
39
+ last_month <= commit. date . 0 . naive_utc ( ) . date ( )
40
+ }
33
41
}
34
42
}
35
43
44
+ /// Tests whether self bounds the commit to the right
36
45
pub fn right_match ( & self , commit : & Commit ) -> bool {
37
46
match self {
38
47
Bound :: Commit ( sha) => commit. sha == * * sha,
@@ -148,7 +157,7 @@ pub fn run_command(cmd: &mut Command) -> anyhow::Result<()> {
148
157
pub fn robocopy (
149
158
from : & std:: path:: Path ,
150
159
to : & std:: path:: Path ,
151
- extra_args : & [ & dyn AsRef < std:: ffi:: OsStr > ]
160
+ extra_args : & [ & dyn AsRef < std:: ffi:: OsStr > ] ,
152
161
) -> anyhow:: Result < ( ) > {
153
162
let mut cmd = Command :: new ( "robocopy" ) ;
154
163
cmd. arg ( from) . arg ( to) . arg ( "/s" ) . arg ( "/e" ) ;
@@ -219,7 +228,7 @@ pub fn command_output(cmd: &mut Command) -> anyhow::Result<process::Output> {
219
228
output. status,
220
229
String :: from_utf8_lossy( & output. stderr) ,
221
230
String :: from_utf8_lossy( & output. stdout)
222
- ) ) ;
231
+ ) ) ;
223
232
}
224
233
225
234
Ok ( output)
@@ -246,7 +255,8 @@ pub struct MasterCommit {
246
255
/// Note that this does not contain try commits today, so it should not be used
247
256
/// to validate hashes or expand them generally speaking. This may also change
248
257
/// in the future.
249
- pub async fn master_commits ( ) -> Result < Vec < MasterCommit > , Box < dyn std:: error:: Error + Sync + Send > > {
258
+ pub async fn master_commits ( ) -> Result < Vec < MasterCommit > , Box < dyn std:: error:: Error + Sync + Send > >
259
+ {
250
260
let response = reqwest:: get ( "https://triage.rust-lang.org/bors-commit-list" ) . await ?;
251
261
Ok ( response. json ( ) . await ?)
252
- }
262
+ }
0 commit comments