From bef25ad5f6c8e334edc118ba94d1cf9aaaa12c7b Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Thu, 12 Sep 2019 07:37:00 +0000 Subject: [PATCH] Avoid excessive allocation in `dc_search_msgs` --- src/context.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/context.rs b/src/context.rs index d6924f332..839edc522 100644 --- a/src/context.rs +++ b/src/context.rs @@ -506,12 +506,12 @@ pub fn dc_search_msgs( return Vec::new(); } - let real_query = to_string(query).trim().to_string(); + let real_query = as_str(query).trim(); if real_query.is_empty() { return Vec::new(); } - let strLikeInText = format!("%{}%", &real_query); - let strLikeBeg = format!("{}%", &real_query); + let strLikeInText = format!("%{}%", real_query); + let strLikeBeg = format!("{}%", real_query); let query = if 0 != chat_id { "SELECT m.id, m.timestamp FROM msgs m LEFT JOIN contacts ct ON m.from_id=ct.id WHERE m.chat_id=? \