aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/factoids/utils.rs
diff options
context:
space:
mode:
authorJokler <jokler.contact@gmail.com>2018-06-30 19:57:37 +0200
committerJokler <jokler.contact@gmail.com>2018-06-30 19:57:37 +0200
commit3929022952ffbd5be0a9ba4ff074a735dea2aed1 (patch)
tree0f2c3847f358c619059b151ea2c33bd2094063cd /src/plugins/factoids/utils.rs
parent82ab100c7e6334dc6fa92e92c8838ecc622118d5 (diff)
downloadfrippy-3929022952ffbd5be0a9ba4ff074a735dea2aed1.tar.gz
frippy-3929022952ffbd5be0a9ba4ff074a735dea2aed1.zip
Plugins: Replace IrcClient with a trait
This is to make it simpler to replace the client in the future.
Diffstat (limited to 'src/plugins/factoids/utils.rs')
-rw-r--r--src/plugins/factoids/utils.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/plugins/factoids/utils.rs b/src/plugins/factoids/utils.rs
index 9352a43..a7bf04a 100644
--- a/src/plugins/factoids/utils.rs
+++ b/src/plugins/factoids/utils.rs
@@ -38,7 +38,9 @@ pub fn download(_: &Lua, url: String) -> Result<String, LuaError> {
fn convert_value(lua: &Lua, sval: SerdeValue, max_recurs: usize) -> Result<LuaValue, LuaError> {
if max_recurs == 0 {
- return Err(RuntimeError(String::from("Reached max recursion level - json is nested too deep")));
+ return Err(RuntimeError(String::from(
+ "Reached max recursion level - json is nested too deep",
+ )));
}
let lval = match sval {
@@ -46,7 +48,9 @@ fn convert_value(lua: &Lua, sval: SerdeValue, max_recurs: usize) -> Result<LuaVa
SerdeValue::Bool(b) => LuaValue::Boolean(b),
SerdeValue::String(s) => LuaValue::String(lua.create_string(&s)?),
SerdeValue::Number(n) => {
- let f = n.as_f64().ok_or(RuntimeError(String::from("Failed to convert number into double",)))?;
+ let f = n.as_f64().ok_or(RuntimeError(String::from(
+ "Failed to convert number into double",
+ )))?;
LuaValue::Number(f)
}
SerdeValue::Array(arr) => {