Skip to content

Commit

Permalink
Reflect deprecation of from_utc in chrono crate (gluesql#1415)
Browse files Browse the repository at this point in the history
Resolved Clippy warning
Ref. https://docs.rs/chrono/latest/src/chrono/datetime/mod.rs.html#130

Signed-off-by: zmrdltl <meenseek5929@naver.com>
  • Loading branch information
zmrdltl committed Sep 30, 2023
1 parent 5a43cd2 commit ad2c4fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/src/data/value/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use {
super::ValueError::ValueToExprConversionFailure,
crate::{
ast::{AstLiteral, DateTimeField, Expr},
chrono::{DateTime, Utc},
chrono::{TimeZone, Utc},
data::Interval,
prelude::{DataType, Value},
result::{Error, Result},
Expand Down Expand Up @@ -69,7 +69,7 @@ impl TryFrom<Value> for Expr {
},
Value::Timestamp(v) => Expr::TypedString {
data_type: DataType::Timestamp,
value: DateTime::<Utc>::from_utc(v, Utc).to_string(),
value: Utc.from_utc_datetime(&v).to_string(),
},
Value::Time(v) => Expr::TypedString {
data_type: DataType::Time,
Expand Down
4 changes: 2 additions & 2 deletions core/src/data/value/json.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use {
super::{Value, ValueError},
crate::result::{Error, Result},
chrono::{offset::Utc, DateTime},
chrono::{offset::Utc, TimeZone},
core::str::FromStr,
serde_json::{Map as JsonMap, Number as JsonNumber, Value as JsonValue},
std::collections::HashMap,
Expand Down Expand Up @@ -79,7 +79,7 @@ impl TryFrom<Value> for JsonValue {
Value::Bytea(v) => Ok(hex::encode(v).into()),
Value::Inet(v) => Ok(v.to_string().into()),
Value::Date(v) => Ok(v.to_string().into()),
Value::Timestamp(v) => Ok(DateTime::<Utc>::from_utc(v, Utc).to_string().into()),
Value::Timestamp(v) => Ok(Utc.from_utc_datetime(&v).to_string().into()),
Value::Time(v) => Ok(v.to_string().into()),
Value::Interval(v) => Ok(v.to_sql_str().into()),
Value::Uuid(v) => Ok(Uuid::from_u128(v).hyphenated().to_string().into()),
Expand Down

0 comments on commit ad2c4fc

Please sign in to comment.