diff --git a/src/data/config.rs b/src/data/config.rs index 9f295a2..82d151f 100644 --- a/src/data/config.rs +++ b/src/data/config.rs @@ -35,7 +35,7 @@ pub struct IndependentPushService { #[derive(Debug)] pub struct Config { - pub port: i32, + pub port: u64, pub listen_address: String, pub storage_url: String, pub storage_path: String, @@ -59,10 +59,6 @@ pub struct Config { static mut CONF: Option = None; impl Config { - fn yaml_i32(parsed: &Yaml, name: &str) -> i32 { - parsed[name].as_i64().expect(format!("{} is missing (int)", name).as_str()) as i32 - } - fn yaml_u64(parsed: &Yaml, name: &str) -> u64 { parsed[name].as_i64().expect(format!("{} is missing (int)", name).as_str()) as u64 } @@ -123,7 +119,7 @@ impl Config { }; let conf = Config { - port: Config::yaml_i32(parsed, "server-port") as i32, + port: Config::yaml_u64(parsed, "server-port"), listen_address: Config::yaml_str(parsed, "server-address"), storage_url: Config::yaml_str(parsed, "storage-url"), diff --git a/src/helpers/database.rs b/src/helpers/database.rs index 35d1668..76d0748 100644 --- a/src/helpers/database.rs +++ b/src/helpers/database.rs @@ -599,8 +599,8 @@ pub fn query ProcessRowResult>(info: QueryInfo, proce /// Count the number of results a query would have produced pub fn count(mut q: QueryInfo) -> ResultBoxError { - &q.fields.clear(); - &q.fields.push("COUNT(*) as count".to_string()); + q.fields.clear(); + q.fields.push("COUNT(*) as count".to_string()); query(q, |res| res.get_usize("count"))?.pop() .ok_or(ExecError::boxed_new("database::count did not return a result!"))