diff options
author | Sam Tay <samctay@pm.me> | 2022-08-21 01:58:13 -0700 |
---|---|---|
committer | Sam Tay <samctay@pm.me> | 2022-08-21 01:58:13 -0700 |
commit | ebb828cef629f8355f183c0307caa28c4d5c2f8e (patch) | |
tree | ec19d12ae79496293577c42eceda89975fb51d62 | |
parent | e4d44be6537299f54abb36a517abb4c2845ff80e (diff) |
Fix clippy lints
-rw-r--r-- | src/config.rs | 4 | ||||
-rw-r--r-- | src/main.rs | 4 | ||||
-rw-r--r-- | src/stackexchange/scraper.rs | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/config.rs b/src/config.rs index f5e12b5..2c1500d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -10,7 +10,7 @@ use std::process::Stdio; use crate::error::{Error, Result}; use crate::utils; -#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)] +#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)] #[serde(rename_all = "lowercase")] pub enum SearchEngine { DuckDuckGo, @@ -18,7 +18,7 @@ pub enum SearchEngine { StackExchange, } -#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)] +#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq)] #[serde(default)] pub struct Config { pub api_key: Option<String>, diff --git a/src/main.rs b/src/main.rs index 8f235af..c2e8f51 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,8 @@ mod term; mod tui; mod utils; +use std::fmt::Write; + use tokio::runtime::Runtime; use tokio::task; @@ -57,7 +59,7 @@ async fn run() -> Result<Option<(Vec<Question<Markdown>>, Config)>> { md.push_str("|Site Code|Site URL|\n"); md.push_str("|-:|:-|\n"); for s in ls.sites.iter() { - md.push_str(&format!("|{}|{}\n", s.api_site_parameter, s.site_url)); + writeln!(&mut md, "|{}|{}", s.api_site_parameter, s.site_url).ok(); } md.push_str("|-\n"); term.print(&md); diff --git a/src/stackexchange/scraper.rs b/src/stackexchange/scraper.rs index 156c68f..3cc0218 100644 --- a/src/stackexchange/scraper.rs +++ b/src/stackexchange/scraper.rs @@ -17,7 +17,7 @@ const GOOGLE_URL: &str = "https://google.com/search"; // If this is ever an issue, it wouldn't be too hard to account for this; just // keep track of site in the `ordering` field and also return site from the // spawned per-site tasks. -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct ScrapedData { /// Mapping of site code to question ids pub question_ids: HashMap<String, Vec<String>>, @@ -182,7 +182,7 @@ fn question_url_to_id(site_url: &str, input: &str) -> Option<String> { } else { input[0..].to_string() }; - if id.chars().all(|c| c.is_digit(10)) { + if id.chars().all(|c| c.is_ascii_digit()) { Some(id) } else { None |