From c57738349b2690d572b3bba06c26d261ef944158 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Sun, 17 Oct 2021 12:24:45 -0600 Subject: [PATCH] Cargo + Clippy * Also discovered you can implement From outside in modules outside whereT was declared --- geoffrey_api/src/helper/mod.rs | 2 +- geoffrey_db/src/error.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/geoffrey_api/src/helper/mod.rs b/geoffrey_api/src/helper/mod.rs index 23ab8fa..af58c27 100644 --- a/geoffrey_api/src/helper/mod.rs +++ b/geoffrey_api/src/helper/mod.rs @@ -6,7 +6,7 @@ use geoffrey_models::models::player::Player; pub fn get_player_from_req(db: &Database, req: &CommandRequest) -> Result> { if let Some(user_id) = &req.user { Ok(db - .filter(|_, player: &Player| player.has_user_id(user_id)).map_err(|e| e.into())? + .filter(|_, player: &Player| player.has_user_id(user_id))? .next()) } else { Ok(None) diff --git a/geoffrey_db/src/error.rs b/geoffrey_db/src/error.rs index 6e2bf5d..3df03ac 100644 --- a/geoffrey_db/src/error.rs +++ b/geoffrey_db/src/error.rs @@ -35,13 +35,13 @@ impl From for GeoffreyDBError { } } -impl Into for GeoffreyDBError { - fn into(self) -> GeoffreyAPIError { - match self { - GeoffreyDBError::SledError(_) => GeoffreyAPIError::DatabaseError(self.to_string()), - GeoffreyDBError::SerdeJsonError(_) => GeoffreyAPIError::DatabaseError(self.to_string()), +impl From for GeoffreyAPIError { + fn from(e: GeoffreyDBError) -> Self { + match e { + GeoffreyDBError::SledError(_) => GeoffreyAPIError::DatabaseError(e.to_string()), + GeoffreyDBError::SerdeJsonError(_) => GeoffreyAPIError::DatabaseError(e.to_string()), GeoffreyDBError::NotUnique => GeoffreyAPIError::EntryNotUnique, - GeoffreyDBError::NotFound => GeoffreyAPIError::EntryNotFound + GeoffreyDBError::NotFound => GeoffreyAPIError::EntryNotFound, } } }