Mercurial > lbo > hg > geohub
changeset 108:68107e685890
cargo fmt
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sat, 26 Dec 2020 09:04:16 +0100 |
parents | 1edc60154ba9 |
children | 8409b5c263ae |
files | src/notifier.rs src/types.rs src/util.rs |
diffstat | 3 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/notifier.rs Sat Dec 26 09:04:06 2020 +0100 +++ b/src/notifier.rs Sat Dec 26 09:04:16 2020 +0100 @@ -1,4 +1,3 @@ - use crate::db; use crate::types; @@ -197,7 +196,8 @@ unlisten(db.0, client.as_str(), &secret).ok(); // These queries use the primary key index returning one row only and will be quite fast. - let rows = db.check_for_new_rows(client.as_str(), &secret, &None, &Some(nrows.unwrap_or(1))); + let rows = + db.check_for_new_rows(client.as_str(), &secret, &None, &Some(nrows.unwrap_or(1))); if let Some((points, last)) = rows { let geojson = types::geojson_from_points(points); for request in clients.remove(&client_id).unwrap_or(vec![]) {
--- a/src/types.rs Sat Dec 26 09:04:06 2020 +0100 +++ b/src/types.rs Sat Dec 26 09:04:16 2020 +0100 @@ -1,5 +1,5 @@ +use geo_types::Point; use gpx::{self, Gpx}; -use geo_types::Point; /// Non-JSON plain point representation. Flat and representing a database row. #[derive(Debug, Clone)]
--- a/src/util.rs Sat Dec 26 09:04:06 2020 +0100 +++ b/src/util.rs Sat Dec 26 09:04:16 2020 +0100 @@ -29,10 +29,10 @@ pub fn to_kph(unit: &str, num: f64) -> Result<f64, http::GeoHubResponder> { match unit { - "mps" | "ms" | "m/s" => Ok(3.6*num), + "mps" | "ms" | "m/s" => Ok(3.6 * num), "kmh" | "km/h" | "kph" => Ok(num), - "mph" => Ok(1.601*num), - "kn" | "knots" => Ok(1.852*num), - _ => Err(http::bad_request(format!("Unknown unit '{}'", unit))) + "mph" => Ok(1.601 * num), + "kn" | "knots" => Ok(1.852 * num), + _ => Err(http::bad_request(format!("Unknown unit '{}'", unit))), } }