Skip to content

Commit

Permalink
fix cargo test
Browse files Browse the repository at this point in the history
```
error: use of deprecated method `chrono::TimeZone::ymd`: use `with_ymd_and_hms()` instead
   --> ofborg/src/tasks/githubcommentposter.rs:734:29
    |
734 |         let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
    |                             ^^^

error: use of deprecated method `chrono::Date::<Tz>::and_hms`: Use and_hms_opt() instead
   --> ofborg/src/tasks/githubcommentposter.rs:734:46
    |
734 |         let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
    |                                              ^^^^^^^
```

https://docs.rs/chrono/latest/chrono/offset/trait.TimeZone.html#method.with_ymd_and_hms
  • Loading branch information
Artturin committed Oct 24, 2023
1 parent 7898818 commit 8919a5d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ofborg/src/tasks/githubcommentposter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ mod tests {
attrs: vec!["foo".to_owned(), "bar".to_owned()],
};

let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();
assert_eq!(
job_to_check(&job, "x86_64-linux", timestamp),
CheckRunOptions {
Expand Down Expand Up @@ -292,7 +292,7 @@ mod tests {
status: BuildStatus::Success,
};

let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();

assert_eq!(
result_to_check(&result, timestamp),
Expand Down Expand Up @@ -374,7 +374,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
status: BuildStatus::Failure,
};

let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();

assert_eq!(
result_to_check(&result, timestamp),
Expand Down Expand Up @@ -453,7 +453,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
status: BuildStatus::TimedOut,
};

let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();

assert_eq!(
result_to_check(&result, timestamp),
Expand Down Expand Up @@ -533,7 +533,7 @@ error: build of '/nix/store/l1limh50lx2cx45yb2gqpv7k8xl1mik2-gdb-8.1.drv' failed
status: BuildStatus::Success,
};

let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();

assert_eq!(
result_to_check(&result, timestamp),
Expand Down Expand Up @@ -611,7 +611,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
status: BuildStatus::Failure,
};

let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();

assert_eq!(
result_to_check(&result, timestamp),
Expand Down Expand Up @@ -678,7 +678,7 @@ patching script interpreter paths in /nix/store/pcja75y9isdvgz5i00pkrpif9rxzxc29
status: BuildStatus::Skipped,
};

let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();

assert_eq!(
result_to_check(&result, timestamp),
Expand Down Expand Up @@ -731,7 +731,7 @@ foo
status: BuildStatus::Skipped,
};

let timestamp = Utc.ymd(2023, 4, 20).and_hms(13, 37, 42);
let timestamp = Utc.with_ymd_and_hms(2023, 4, 20, 13, 37, 42).unwrap();

assert_eq!(
result_to_check(&result, timestamp),
Expand Down

0 comments on commit 8919a5d

Please sign in to comment.