diff --git a/src/api/ing/mod.rs b/src/api/ing/mod.rs index 8ce9d47..56343b3 100644 --- a/src/api/ing/mod.rs +++ b/src/api/ing/mod.rs @@ -64,7 +64,7 @@ pub fn fmt_content(content: &str) -> String { .expect("Invalid regexp"); } REGEX.captures(content).map_or_else( - || content.to_string(), + || content.to_owned(), |caps| { let at_user = caps.get(1).expect("No capture at index 1").as_str(); REGEX.replace(content, at_user).to_string() @@ -78,7 +78,7 @@ pub fn rm_ing_at_user_tag(text: &str) -> String { Regex::new(r#"(@.*?):"#) .expect("Invalid regexp"); } - REGEX.replace(text, "".to_string()).to_string() + REGEX.replace(text, "").to_string() } pub fn get_ing_at_user_tag_text(text: &str) -> String { @@ -87,13 +87,10 @@ pub fn get_ing_at_user_tag_text(text: &str) -> String { Regex::new(r#"@(.*?):"#) .expect("Invalid regexp"); } - REGEX.captures(text).map_or_else( - || "".to_string(), - |caps| { - caps.get(1) - .expect("No capture at index 1") - .as_str() - .to_string() - }, - ) + REGEX.captures(text).map_or_else(String::new, |caps| { + caps.get(1) + .expect("No capture at index 1") + .as_str() + .to_string() + }) } diff --git a/src/infra/http.rs b/src/infra/http.rs index dbc54ae..16ec4d2 100644 --- a/src/infra/http.rs +++ b/src/infra/http.rs @@ -45,7 +45,7 @@ impl VecExt for Vec<(K, V)> { let s_v = v.to_string(); format!("{}={}", s_k, s_v) }) - .fold("".to_string(), |acc, q| format!("{acc}&{q}")) + .fold(String::new(), |acc, q| format!("{acc}&{q}")) } } diff --git a/src/main.rs b/src/main.rs index 568fccc..ab9f186 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,7 +54,7 @@ fn panic_if_err(result: &Result) { #[tokio::main(flavor = "multi_thread")] async fn main() -> Result<()> { let args_vec = env::args().collect::>(); - if args_vec.iter().any(eq(&"--debug".to_string())) { + if args_vec.iter().any(eq(&"--debug".to_owned())) { dbg!(args_vec); }