glassbench icon indicating copy to clipboard operation
glassbench copied to clipboard

refactor: remove deprecated usage of `chrono`

Open orhun opened this issue 2 years ago • 3 comments

This PR fixes the following warnings:

warning: use of deprecated associated function `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead
   --> src/db.rs:180:19
    |
180 |         time: Utc.timestamp(row.get(1)?, 0),
    |                   ^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: use of deprecated associated function `chrono::TimeZone::timestamp`: use `timestamp_opt()` instead
   --> src/db.rs:210:19
    |
210 |         time: Utc.timestamp(row.get(0)?, 0),
    |                   ^^^^^^^^^

warning: `glassbench` (lib) generated 2 warnings

orhun avatar Dec 10 '22 14:12 orhun

Let me know if you're fine with unwrap(). I tried to use the custom error implementation with LocalResult but couldn't do it. I can look into alternative ways.

orhun avatar Dec 10 '22 14:12 orhun

I don't really see a point, there. Why remove the other function if there's exactly the same level of safety ?

Canop avatar Dec 10 '22 14:12 Canop

They probably decided to make the error handling more explicit. With this change at least you won't get deprecation warnings during build.

orhun avatar Dec 10 '22 18:12 orhun