Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Aug 1, 2023
1 parent ccac77c commit 5469b42
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ actix-web-httpauth = "0.8.0"
rand = "0.8.5"

[build-dependencies]
ureq = "2.6.2"
ureq = "2.7.0"
8 changes: 3 additions & 5 deletions src/webserver/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,21 +271,19 @@ fn sql_nonnull_to_json<'r>(mut get_ref: impl FnMut() -> sqlx::any::AnyValueRef<'
.into(),
"DATE" => <chrono::NaiveDate as Decode<sqlx::any::Any>>::decode(raw_value)
.as_ref()
.map(ToString::to_string)
.unwrap_or_else(|e| e.to_string())
.map_or_else(std::string::ToString::to_string, ToString::to_string)
.into(),
"TIME" => <chrono::NaiveTime as Decode<sqlx::any::Any>>::decode(raw_value)
.as_ref()
.map(ToString::to_string)
.unwrap_or_else(|e| e.to_string())
.map_or_else(ToString::to_string, ToString::to_string)
.into(),
"DATETIME" | "DATETIME2" | "DATETIMEOFFSET" | "TIMESTAMP" | "TIMESTAMPTZ" => {
try_decode_with!(
get_ref(),
[chrono::NaiveDateTime, chrono::DateTime<chrono::Utc>],
|v| dbg!(v).to_string()
)
.unwrap_or_else(|e| format!("Unable to decode date: {:?}", e))
.unwrap_or_else(|e| format!("Unable to decode date: {e:?}"))
.into()
}
"JSON" | "JSON[]" | "JSONB" | "JSONB[]" => {
Expand Down

0 comments on commit 5469b42

Please sign in to comment.