From 45aa4748b0b19efd5f84d32e7ae6f66643275490 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Sat, 21 Jul 2018 12:29:14 -0700 Subject: Fix usage of str::replace --- src/content.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/content.rs b/src/content.rs index 7ebc129..8d025c9 100644 --- a/src/content.rs +++ b/src/content.rs @@ -30,13 +30,13 @@ pub fn query_url_gen(title: &str) -> String { pub fn search_url_gen(search: &str) -> String { // search config - search.replace(" ", "%20"); + let search = search.replace(" ", "%20"); let mut url = String::from("https://en.wikipedia.org"); url.push_str("/w/api.php?"); url.push_str("action=opensearch&"); url.push_str("format=json&"); url.push_str("search="); - url.push_str(&urlencoding::encode(search)); + url.push_str(&urlencoding::encode(&search)); url.push_str("&"); url.push_str("limit=20"); url @@ -52,7 +52,7 @@ pub fn get_extract(v: &Value) -> Result { match &v["query"]["pages"][pageid_str]["extract"] { Value::String(extract) => { // format to plain text - extract.replace("\\\\", "\\"); + let extract = extract.replace("\\\\", "\\"); Ok(format!("{}", extract)) } -- cgit v1.2.3