diff --git a/src/main.rs b/src/main.rs index ee4e346..ee24c42 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,3 @@ -#[allow(unused_imports)] #[macro_use] extern crate serde_derive; @@ -8,8 +7,6 @@ use std::error::Error; use std::fs::{create_dir_all, read_to_string, write as fs_write}; use std::iter::IntoIterator; use std::path::PathBuf; -use std::thread; -use std::time::Duration; use std::time::{SystemTime, UNIX_EPOCH}; mod model; @@ -129,14 +126,4 @@ fn update( Ok(updated) } -#[allow(dead_code)] -fn poll(interval: Duration, count: Option) { - let mut it: u32 = 0; - loop { - thread::sleep(interval); - it += 1; - if count.map(|c| c < it).unwrap_or(false) { - break; - } - } -} + diff --git a/src/model.rs b/src/model.rs index 018ad59..3960d81 100644 --- a/src/model.rs +++ b/src/model.rs @@ -22,7 +22,7 @@ impl Comment { let created = UNIX_EPOCH + Duration::from_secs(self.created as u64); let edited = self .edited - .filter(|e| e > &1) + .filter(|e|*e > 1) .map(|e| UNIX_EPOCH + Duration::from_secs(e)); if let Some(edited) = edited { if edited > created { @@ -48,7 +48,7 @@ impl fmt::Display for CommentDelta { match self { Votes(d) if *d > 0 => write!(f, "Received +{} upvotes", d), Votes(d) if *d < 0 => write!(f, "Received {} downvotes", d), - Votes(_) => write!(f, "You shouln't see this one, if you do check the source"), + Votes(_) => unreachable!("CommentDelta::Votes cannot be 0"), Content => write!(f, "Edited"), New => write!(f, "Created"), }