File tree 2 files changed +7
-9
lines changed
tokio-postgres/tests/test/types
2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ impl ToSql for NaiveDateTime {
42
42
impl < ' a > FromSql < ' a > for DateTime < Utc > {
43
43
fn from_sql ( type_ : & Type , raw : & [ u8 ] ) -> Result < DateTime < Utc > , Box < dyn Error + Sync + Send > > {
44
44
let naive = NaiveDateTime :: from_sql ( type_, raw) ?;
45
- Ok ( Utc :: from_utc_datetime ( naive) )
45
+ Ok ( Utc . from_utc_datetime ( & naive) )
46
46
}
47
47
48
48
accepts ! ( TIMESTAMPTZ ) ;
Original file line number Diff line number Diff line change @@ -53,10 +53,9 @@ async fn test_with_special_naive_date_time_params() {
53
53
async fn test_date_time_params ( ) {
54
54
fn make_check ( time : & str ) -> ( Option < DateTime < Utc > > , & str ) {
55
55
(
56
- Some (
57
- Utc . datetime_from_str ( time, "'%Y-%m-%d %H:%M:%S.%f'" )
58
- . unwrap ( ) ,
59
- ) ,
56
+ Some ( Utc . from_utc_datetime (
57
+ & NaiveDateTime :: parse_from_str ( time, "'%Y-%m-%d %H:%M:%S.%f'" ) . unwrap ( ) ,
58
+ ) ) ,
60
59
time,
61
60
)
62
61
}
@@ -76,10 +75,9 @@ async fn test_date_time_params() {
76
75
async fn test_with_special_date_time_params ( ) {
77
76
fn make_check ( time : & str ) -> ( Timestamp < DateTime < Utc > > , & str ) {
78
77
(
79
- Timestamp :: Value (
80
- Utc . datetime_from_str ( time, "'%Y-%m-%d %H:%M:%S.%f'" )
81
- . unwrap ( ) ,
82
- ) ,
78
+ Timestamp :: Value ( Utc . from_utc_datetime (
79
+ & NaiveDateTime :: parse_from_str ( time, "'%Y-%m-%d %H:%M:%S.%f'" ) . unwrap ( ) ,
80
+ ) ) ,
83
81
time,
84
82
)
85
83
}
You can’t perform that action at this time.
0 commit comments