Skip to content

pr: use chrono instead of time in tests #5972

@cakebaker

Description

@cakebaker

When running cargo test --features "pr" --no-default-features the following errors are shown:

error[E0432]: unresolved import `time::macros`
 --> tests/by-util/test_pr.rs:9:11
  |
9 | use time::macros::format_description;
  |           ^^^^^^ could not find `macros` in `time`

error: cannot determine resolution for the macro `format_description`
  --> tests/by-util/test_pr.rs:14:5
   |
14 |     format_description!("[month repr:short] [day] [hour]:[minute] [year]");
   |     ^^^^^^^^^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error[E0433]: failed to resolve: could not find `format_description` in `time`
  --> tests/by-util/test_pr.rs:13:33
   |
13 | const DATE_TIME_FORMAT: &[time::format_description::FormatItem] =
   |                                 ^^^^^^^^^^^^^^^^^^ could not find `format_description` in `time`

error[E0599]: no method named `format` found for struct `OffsetDateTime` in the current scope
  --> tests/by-util/test_pr.rs:24:31
   |
24 |                     date_time.format(&DATE_TIME_FORMAT).unwrap()
   |                               ^^^^^^ method not found in `OffsetDateTime`

error[E0599]: no method named `format` found for struct `OffsetDateTime` in the current scope
  --> tests/by-util/test_pr.rs:37:26
   |
37 |         vec.push(current.format(&DATE_TIME_FORMAT).unwrap());
   |                          ^^^^^^ method not found in `OffsetDateTime`

The reason is #4942: it replaced time with chrono and forgot to adapt the tests.

I noticed this issue as it showed up as a side effect in #5934

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions