aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content.rs6
1 files 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 {
30 30
31pub fn search_url_gen(search: &str) -> String { 31pub fn search_url_gen(search: &str) -> String {
32 // search config 32 // search config
33 search.replace(" ", "%20"); 33 let search = search.replace(" ", "%20");
34 let mut url = String::from("https://en.wikipedia.org"); 34 let mut url = String::from("https://en.wikipedia.org");
35 url.push_str("/w/api.php?"); 35 url.push_str("/w/api.php?");
36 url.push_str("action=opensearch&"); 36 url.push_str("action=opensearch&");
37 url.push_str("format=json&"); 37 url.push_str("format=json&");
38 url.push_str("search="); 38 url.push_str("search=");
39 url.push_str(&urlencoding::encode(search)); 39 url.push_str(&urlencoding::encode(&search));
40 url.push_str("&"); 40 url.push_str("&");
41 url.push_str("limit=20"); 41 url.push_str("limit=20");
42 url 42 url
@@ -52,7 +52,7 @@ pub fn get_extract(v: &Value) -> Result<String, reqwest::Error> {
52 match &v["query"]["pages"][pageid_str]["extract"] { 52 match &v["query"]["pages"][pageid_str]["extract"] {
53 Value::String(extract) => { 53 Value::String(extract) => {
54 // format to plain text 54 // format to plain text
55 extract.replace("\\\\", "\\"); 55 let extract = extract.replace("\\\\", "\\");
56 56
57 Ok(format!("{}", extract)) 57 Ok(format!("{}", extract))
58 } 58 }