aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/remind/database.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-06-16 15:35:49 +0200
committerJokler <jokler.contact@gmail.com>2018-06-16 15:35:49 +0200
commit9baade2a5d9fec54fe4d88216fbdb91c154ad348 (patch)
treee4bee7605f2c2738574ad7d7a671c8b843bf53b5 /src/plugins/remind/database.rs
parent768fcc68af3cc57f52ac7117cbf325479836159a (diff)
downloadfrippy-9baade2a5d9fec54fe4d88216fbdb91c154ad348.tar.gz
frippy-9baade2a5d9fec54fe4d88216fbdb91c154ad348.zip
Fix clippy warnings
Diffstat (limited to 'src/plugins/remind/database.rs')
-rw-r--r--src/plugins/remind/database.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/plugins/remind/database.rs b/src/plugins/remind/database.rs
index e434ec0..97d93e8 100644
--- a/src/plugins/remind/database.rs
+++ b/src/plugins/remind/database.rs
@@ -1,5 +1,5 @@
-use std::collections::HashMap;
use std::collections::hash_map::Entry;
+use std::collections::HashMap;
use std::fmt;
#[cfg(feature = "mysql")]
@@ -66,7 +66,7 @@ pub trait Database: Send + Sync {
}
// HashMap
-impl Database for HashMap<i64, Event> {
+impl<S: ::std::hash::BuildHasher + Send + Sync> Database for HashMap<i64, Event, S> {
fn insert_event(&mut self, event: &NewEvent) -> Result<i64, RemindError> {
let mut id = 0;
while self.contains_key(&id) {
@@ -74,11 +74,11 @@ impl Database for HashMap<i64, Event> {
}
let event = Event {
- id: id,
+ id,
receiver: event.receiver.to_owned(),
content: event.content.to_owned(),
author: event.author.to_owned(),
- time: event.time.clone(),
+ time: *event.time,
repeat: event.repeat,
};
@@ -103,7 +103,7 @@ impl Database for HashMap<i64, Event> {
let mut events = Vec::new();
for (_, event) in self.iter() {
- if &event.time < time {
+ if event.time < *time {
events.push(event.clone())
}
}
@@ -132,9 +132,7 @@ impl Database for HashMap<i64, Event> {
}
fn get_event(&self, id: i64) -> Result<Event, RemindError> {
- Ok(self.get(&id)
- .map(|ev| ev.clone())
- .ok_or(ErrorKind::NotFound)?)
+ Ok(self.get(&id).cloned().ok_or(ErrorKind::NotFound)?)
}
fn delete_event(&mut self, id: i64) -> Result<(), RemindError> {