diff --git a/src/wot_log.rs b/src/wot_log.rs index 2044523..1d0f8ee 100644 --- a/src/wot_log.rs +++ b/src/wot_log.rs @@ -3,7 +3,6 @@ use std::io::Write; use std::path::PathBuf; use actix_multipart::Multipart; -use actix_web::Error; use chrono::Utc; use futures_util::StreamExt; @@ -12,6 +11,8 @@ use serde_json::{Map, Value, to_string_pretty}; use crate::{client, Client}; +type Result = std::result::Result>; + #[derive(Debug)] pub struct WotLog { /// ID of the log @@ -53,7 +54,7 @@ impl WotLog { } } - pub async fn from_payload(payload: Multipart) -> Result { + pub async fn from_payload(payload: Multipart) -> Result { let mut payload = payload; let mut wotlog = WotLog::new(); @@ -88,7 +89,7 @@ impl WotLog { } /// Read and parse the log - pub fn parse_log(self: &mut Self) -> Result<(), Error> { + pub fn parse_log(self: &mut Self) -> Result<()> { let mut map: Map = Map::new(); map.insert("id".into(), self.id.clone().into()); map.insert("player".into(), self.player.clone().into()); @@ -100,7 +101,9 @@ impl WotLog { } Client::TinTin => (), Client::ZMud => (), - Client::None => (), + Client::None => { + return Err("no client specified".into()) + } }; self.json = map.into(); @@ -109,7 +112,7 @@ impl WotLog { } /// save the json to disk - pub fn save(self: &mut Self) -> Result<(), Error> { + pub fn save(self: &mut Self) -> Result<()> { let path = PathBuf::from("replays"); if !path.is_dir() {