aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/factoids/database.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-05-12 00:21:59 +0200
committerJokler <jokler.contact@gmail.com>2018-05-12 00:21:59 +0200
commit6ec0c444f642630485ca18b3043191b67a6f8e8c (patch)
tree433d04f5b51dfb287536dd624b5c24075b5d227f /src/plugins/factoids/database.rs
parent518fa4a3d523b481e2d72e78361dd979e6c850f4 (diff)
downloadfrippy-6ec0c444f642630485ca18b3043191b67a6f8e8c.tar.gz
frippy-6ec0c444f642630485ca18b3043191b67a6f8e8c.zip
Factoids: Improve display of runtime errors in lua
Diffstat (limited to 'src/plugins/factoids/database.rs')
-rw-r--r--src/plugins/factoids/database.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/factoids/database.rs b/src/plugins/factoids/database.rs
index 321931f..702834f 100644
--- a/src/plugins/factoids/database.rs
+++ b/src/plugins/factoids/database.rs
@@ -51,10 +51,10 @@ pub trait Database: Send + Sync {
impl Database for HashMap<(String, i32), Factoid> {
fn insert_factoid(&mut self, factoid: &NewFactoid) -> Result<(), FactoidsError> {
let factoid = Factoid {
- name: String::from(factoid.name),
+ name: factoid.name.to_owned(),
idx: factoid.idx,
- content: factoid.content.to_string(),
- author: factoid.author.to_string(),
+ content: factoid.content.to_owned(),
+ author: factoid.author.to_owned(),
created: factoid.created,
};
@@ -66,13 +66,13 @@ impl Database for HashMap<(String, i32), Factoid> {
}
fn get_factoid(&self, name: &str, idx: i32) -> Result<Factoid, FactoidsError> {
- Ok(self.get(&(String::from(name), idx))
+ Ok(self.get(&(name.to_owned(), idx))
.cloned()
.ok_or(ErrorKind::NotFound)?)
}
fn delete_factoid(&mut self, name: &str, idx: i32) -> Result<(), FactoidsError> {
- match self.remove(&(String::from(name), idx)) {
+ match self.remove(&(name.to_owned(), idx)) {
Some(_) => Ok(()),
None => Err(ErrorKind::NotFound)?,
}