Cargo + Clippy

* Also discovered you can implement From<T> outside in modules outside whereT was declared
main
Joey Hines 2021-10-17 12:24:45 -06:00
parent c2bc16f3d8
commit c57738349b
No known key found for this signature in database
GPG Key ID: 80F567B5C968F91B
2 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@ use geoffrey_models::models::player::Player;
pub fn get_player_from_req<T>(db: &Database, req: &CommandRequest<T>) -> Result<Option<Player>> {
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)

View File

@ -35,13 +35,13 @@ impl From<serde_json::Error> for GeoffreyDBError {
}
}
impl Into<GeoffreyAPIError> for GeoffreyDBError {
fn into(self) -> GeoffreyAPIError {
match self {
GeoffreyDBError::SledError(_) => GeoffreyAPIError::DatabaseError(self.to_string()),
GeoffreyDBError::SerdeJsonError(_) => GeoffreyAPIError::DatabaseError(self.to_string()),
impl From<GeoffreyDBError> 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,
}
}
}