File tree Expand file tree Collapse file tree 3 files changed +11
-21
lines changed Expand file tree Collapse file tree 3 files changed +11
-21
lines changed Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ DUCKDB_LIB_DIR = /Users/wangfenjin/duckdb
77DUCKDB_INCLUDE_DIR = /Users/wangfenjin/duckdb
88
99all :
10- cargo test --features buildtime_bindgen -- --nocapture
11- cargo clippy --all-targets --workspace --features buildtime_bindgen -- -D warnings -A clippy::redundant-closure
10+ cargo test --features buildtime_bindgen --features modern-full -- --nocapture
11+ cargo clippy --all-targets --workspace --features buildtime_bindgen --features modern-full -- -D warnings -A clippy::redundant-closure
Original file line number Diff line number Diff line change @@ -57,9 +57,9 @@ impl FromSql for NaiveDateTime {
5757 ValueRef :: Timestamp ( tu, t) => {
5858 let ( secs, nsecs) = match tu {
5959 TimeUnit :: Second => ( t, 0 ) ,
60- TimeUnit :: Millisecond => ( t / 1000 , ( t % 1000 ) * 1000_000 ) ,
61- TimeUnit :: Microsecond => ( t / 1000_000 , ( t % 1000_000 ) * 1000 ) ,
62- TimeUnit :: Nanosecond => ( t / 1000_000_000 , t % 1000_000_000 ) ,
60+ TimeUnit :: Millisecond => ( t / 1000 , ( t % 1000 ) * 1_000_000 ) ,
61+ TimeUnit :: Microsecond => ( t / 1_000_000 , ( t % 1_000_000 ) * 1000 ) ,
62+ TimeUnit :: Nanosecond => ( t / 1_000_000_000 , t % 1_000_000_000 ) ,
6363 } ;
6464 Ok ( NaiveDateTime :: from_timestamp ( secs, nsecs as u32 ) )
6565 }
Original file line number Diff line number Diff line change @@ -171,22 +171,12 @@ impl FromSql for String {
171171 #[ inline]
172172 fn column_result ( value : ValueRef < ' _ > ) -> FromSqlResult < Self > {
173173 match value {
174- ValueRef :: Date32 ( d) => {
175- if cfg ! ( feature = "chrono" ) {
176- Ok ( chrono:: NaiveDate :: column_result ( value) ?. format ( "%F" ) . to_string ( ) )
177- } else {
178- Ok ( d. to_string ( ) )
179- }
180- }
181- ValueRef :: Timestamp ( _, t) => {
182- if cfg ! ( feature = "chrono" ) {
183- Ok ( chrono:: NaiveDateTime :: column_result ( value) ?
184- . format ( "%F %T%.f" )
185- . to_string ( ) )
186- } else {
187- Ok ( t. to_string ( ) )
188- }
189- }
174+ #[ cfg( feature = "chrono" ) ]
175+ ValueRef :: Date32 ( _) => Ok ( chrono:: NaiveDate :: column_result ( value) ?. format ( "%F" ) . to_string ( ) ) ,
176+ #[ cfg( feature = "chrono" ) ]
177+ ValueRef :: Timestamp ( ..) => Ok ( chrono:: NaiveDateTime :: column_result ( value) ?
178+ . format ( "%F %T%.f" )
179+ . to_string ( ) ) ,
190180 _ => value. as_str ( ) . map ( ToString :: to_string) ,
191181 }
192182 }
You can’t perform that action at this time.
0 commit comments