diff options
author | Sam Tay <samctay@pm.me> | 2022-02-22 15:24:23 -0500 |
---|---|---|
committer | Sam Tay <samctay@pm.me> | 2022-02-22 15:24:23 -0500 |
commit | b32e23caf1e858778e26c396063ef2ef1192e4c1 (patch) | |
tree | 2fe32034d1f832e20de14b878d3363bb7627a599 /src/stackexchange | |
parent | 6c7c2b109613f7125a8e6aaa5220d85e89c04944 (diff) |
Obey clippy
Diffstat (limited to 'src/stackexchange')
-rw-r--r-- | src/stackexchange/api.rs | 2 | ||||
-rw-r--r-- | src/stackexchange/scraper.rs | 6 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/stackexchange/api.rs b/src/stackexchange/api.rs index c9b69b4..cf326f2 100644 --- a/src/stackexchange/api.rs +++ b/src/stackexchange/api.rs @@ -153,7 +153,7 @@ impl Api { params.insert("filter", SE_FILTER); params.insert("page", "1"); if let Some(key) = &self.api_key { - params.insert("key", &key); + params.insert("key", key); } params } diff --git a/src/stackexchange/scraper.rs b/src/stackexchange/scraper.rs index 97c4bef..b1354fa 100644 --- a/src/stackexchange/scraper.rs +++ b/src/stackexchange/scraper.rs @@ -51,7 +51,7 @@ impl Scraper for DuckDuckGo { parse_with_selector(anchors, html, sites, limit).and_then(|sd| { // DDG seems to never have empty results, so assume this is blocked if sd.question_ids.is_empty() { - Err(Error::ScrapingError(String::from( + Err(Error::Scraping(String::from( "DuckDuckGo blocked this request", ))) } else { @@ -325,9 +325,7 @@ mod tests { ); match DuckDuckGo.parse(html, &sites, 2) { - Err(Error::ScrapingError(s)) if s == "DuckDuckGo blocked this request".to_string() => { - Ok(()) - } + Err(Error::Scraping(s)) if s == "DuckDuckGo blocked this request".to_string() => Ok(()), _ => Err(String::from("Failed to detect DuckDuckGo blocker")), } } |