diff options
author | Joris | 2022-02-26 22:23:34 +0100 |
---|---|---|
committer | Joris | 2022-02-26 22:23:34 +0100 |
commit | 01a1e5e4f45dc80cd430d18492817b733fab5603 (patch) | |
tree | fa39d7abaf04d9b805a19767c088f7d61eecb509 /src/util | |
parent | 4ff3fa15967d989658804b94e1ce035dfd3e5a5c (diff) |
Fix linter warnings
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/event.rs | 10 | ||||
-rw-r--r-- | src/util/serialization.rs | 6 | ||||
-rw-r--r-- | src/util/time.rs | 2 |
3 files changed, 8 insertions, 10 deletions
diff --git a/src/util/event.rs b/src/util/event.rs index 33ee9ec..05d8581 100644 --- a/src/util/event.rs +++ b/src/util/event.rs @@ -43,12 +43,10 @@ impl Events { let tx = tx.clone(); thread::spawn(move || { let stdin = io::stdin(); - for evt in stdin.keys() { - if let Ok(key) = evt { - if let Err(err) = tx.send(Event::Input(key)) { - eprintln!("{}", err); - return; - } + for key in stdin.keys().flatten() { + if let Err(err) = tx.send(Event::Input(key)) { + eprintln!("{}", err); + return; } } }) diff --git a/src/util/serialization.rs b/src/util/serialization.rs index cc2899f..61b3a83 100644 --- a/src/util/serialization.rs +++ b/src/util/serialization.rs @@ -1,10 +1,10 @@ -pub fn line_to_words(line: &String) -> Vec<String> { - line.split("|") +pub fn line_to_words(line: &str) -> Vec<String> { + line.split('|') .map(|w| w.trim().to_string()) .filter(|w| !w.is_empty()) .collect() } -pub fn words_to_line(words: &Vec<String>) -> String { +pub fn words_to_line(words: &[String]) -> String { words.join(" | ") } diff --git a/src/util/time.rs b/src/util/time.rs index d9a9f72..b8a85e6 100644 --- a/src/util/time.rs +++ b/src/util/time.rs @@ -3,7 +3,7 @@ use std::thread; use std::time::SystemTime; pub fn seconds_since_unix_epoch() -> Result<u64> { - Ok(seconds_since_unix_epoch_of(SystemTime::now())?) + seconds_since_unix_epoch_of(SystemTime::now()) } pub fn seconds_since_unix_epoch_of(time: SystemTime) -> Result<u64> { |