From 2956aa5f5324e4183dbc87f81fbc71fd0f43dbf9 Mon Sep 17 00:00:00 2001 From: Joris Date: Thu, 6 Feb 2025 19:10:54 +0100 Subject: Improve String handling See https://blog.sulami.xyz/posts/string-vs-str/ --- src/db/incomes.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/db/incomes.rs') diff --git a/src/db/incomes.rs b/src/db/incomes.rs index 90282c0..688e9e1 100644 --- a/src/db/incomes.rs +++ b/src/db/incomes.rs @@ -373,8 +373,8 @@ fn cumulative_query(from: NaiveDate) -> String { ON users.id = incomes.user_id "#, - bounded_query(">".to_string(), from.format("%Y-%m-%d").to_string()), - bounded_query("<".to_string(), "date()".to_string()) + bounded_query(">", &from.format("%Y-%m-%d").to_string()), + bounded_query("<", "date()") ) } @@ -382,7 +382,7 @@ fn cumulative_query(from: NaiveDate) -> String { /// /// It filters incomes according to the operator and date, /// and adds the income at this date. -fn bounded_query(op: String, date: String) -> String { +fn bounded_query(op: &str, date: &str) -> String { format!( r#" SELECT -- cgit v1.2.3