mirror of
https://github.com/shimunn/gitredditor.git
synced 2023-11-17 18:42:43 +01:00
cleanup
This commit is contained in:
parent
166a4ba0de
commit
6e1ab723e8
15
src/main.rs
15
src/main.rs
@ -1,4 +1,3 @@
|
|||||||
#[allow(unused_imports)]
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
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::fs::{create_dir_all, read_to_string, write as fs_write};
|
||||||
use std::iter::IntoIterator;
|
use std::iter::IntoIterator;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::thread;
|
|
||||||
use std::time::Duration;
|
|
||||||
use std::time::{SystemTime, UNIX_EPOCH};
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
mod model;
|
mod model;
|
||||||
@ -129,14 +126,4 @@ fn update(
|
|||||||
Ok(updated)
|
Ok(updated)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
fn poll(interval: Duration, count: Option<u32>) {
|
|
||||||
let mut it: u32 = 0;
|
|
||||||
loop {
|
|
||||||
thread::sleep(interval);
|
|
||||||
it += 1;
|
|
||||||
if count.map(|c| c < it).unwrap_or(false) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -22,7 +22,7 @@ impl Comment {
|
|||||||
let created = UNIX_EPOCH + Duration::from_secs(self.created as u64);
|
let created = UNIX_EPOCH + Duration::from_secs(self.created as u64);
|
||||||
let edited = self
|
let edited = self
|
||||||
.edited
|
.edited
|
||||||
.filter(|e| e > &1)
|
.filter(|e|*e > 1)
|
||||||
.map(|e| UNIX_EPOCH + Duration::from_secs(e));
|
.map(|e| UNIX_EPOCH + Duration::from_secs(e));
|
||||||
if let Some(edited) = edited {
|
if let Some(edited) = edited {
|
||||||
if edited > created {
|
if edited > created {
|
||||||
@ -48,7 +48,7 @@ impl fmt::Display for CommentDelta {
|
|||||||
match self {
|
match self {
|
||||||
Votes(d) if *d > 0 => write!(f, "Received +{} upvotes", d),
|
Votes(d) if *d > 0 => write!(f, "Received +{} upvotes", d),
|
||||||
Votes(d) if *d < 0 => write!(f, "Received {} downvotes", 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"),
|
Content => write!(f, "Edited"),
|
||||||
New => write!(f, "Created"),
|
New => write!(f, "Created"),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user