From de757e7e5093ee2b95d76016e3251f10667dce8a Mon Sep 17 00:00:00 2001 From: Bulat Kurbanov Date: Tue, 9 May 2023 00:09:06 +0200 Subject: [PATCH] Optimize --- src/types.rs | 2 +- src/updater.rs | 4 ++-- src/utils.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/types.rs b/src/types.rs index f442f05..e4f02fb 100644 --- a/src/types.rs +++ b/src/types.rs @@ -127,7 +127,7 @@ impl FromVecExpression for Book { }, uploaded: match &value[2] { sql_parse::Expression::String(v) => { - NaiveDateTime::parse_from_str(&v.value.to_string(), "%Y-%m-%d %H:%M:%S") + NaiveDateTime::parse_from_str(&v.value, "%Y-%m-%d %H:%M:%S") .unwrap() .date() } diff --git a/src/updater.rs b/src/updater.rs index a981f3e..e579727 100644 --- a/src/updater.rs +++ b/src/updater.rs @@ -83,7 +83,7 @@ async fn process( where T: Debug + FromVecExpression + Update, { - if deps.len() != 0 { + if !deps.is_empty() { loop { let mut some_failed = false; let mut some_none = false; @@ -155,7 +155,7 @@ where match value.update(&client, source_id).await { Ok(_) => { // log::info!("{:?}", value); - () + } Err(err) => { log::error!("Update error: {:?} : {:?}", value, err); diff --git a/src/utils.rs b/src/utils.rs index 1fa3c3b..9306cf4 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -21,7 +21,7 @@ pub fn remove_wrong_chars(s: &str) -> String { } pub fn parse_lang(s: &str) -> String { - s.replace('-', "").replace('~', "").to_lowercase() + s.replace(['-', '~'], "").to_lowercase() } pub fn fix_annotation_text(text: &str) -> String {