removes some unused warnings

This commit is contained in:
2019-10-27 16:13:29 +01:00
parent ae991bf4dc
commit df06e2cf4a

View File

@@ -55,10 +55,11 @@ pub enum ApiError {
/// Every allowed queries on the database /// Every allowed queries on the database
pub enum ApiActions { pub enum ApiActions {
// Application level
FetchPlayers, FetchPlayers,
FetchInventory, FetchInventory,
FetchClaims, FetchClaims,
// Player actions // Player level
FetchPlayer(i32), FetchPlayer(i32),
FetchNotifications(i32), FetchNotifications(i32),
FetchLoot(i32), FetchLoot(i32),
@@ -67,14 +68,12 @@ pub enum ApiActions {
SellItems(i32, SellParams), SellItems(i32, SellParams),
ClaimItem(i32, i32), ClaimItem(i32, i32),
UnclaimItem(i32, i32), UnclaimItem(i32, i32),
// Group actions // Group level
AddLoot(Vec<db::Item>), AddLoot(Vec<db::Item>),
} // Admin level
//AddPlayer(String, f64),
pub enum AdminActions {
AddPlayer(String, f64),
//AddInventoryItem(pub String, pub i32), //AddInventoryItem(pub String, pub i32),
ResolveClaims, //ResolveClaims,
//SetClaimsTimeout(pub i32), //SetClaimsTimeout(pub i32),
} }
@@ -83,7 +82,7 @@ pub fn execute(
query: ApiActions, query: ApiActions,
) -> Result<ApiResponse, diesel::result::Error> { ) -> Result<ApiResponse, diesel::result::Error> {
let mut response = ApiResponse::default(); let mut response = ApiResponse::default();
// TODO: Return an Option<String> that describes what happened. // Return an Option<String> that describes what happened.
// If there is some value, store the actions in db so that it can be reversed. // If there is some value, store the actions in db so that it can be reversed.
let action_text: Option<&str> = match query { let action_text: Option<&str> = match query {
ApiActions::FetchPlayers => { ApiActions::FetchPlayers => {
@@ -189,12 +188,12 @@ pub fn execute(
} }
ApiActions::ClaimItem(id, item) => { ApiActions::ClaimItem(id, item) => {
response.push_update(Update::ClaimAdded(db::Claims(conn).add(id, item)?)); response.push_update(Update::ClaimAdded(db::Claims(conn).add(id, item)?));
response.notify(format!("Pour moi !")); response.notify("Pour moi !".to_string());
None None
} }
ApiActions::UnclaimItem(id, item) => { ApiActions::UnclaimItem(id, item) => {
response.push_update(Update::ClaimRemoved(db::Claims(conn).remove(id, item)?)); response.push_update(Update::ClaimRemoved(db::Claims(conn).remove(id, item)?));
response.notify(format!("Bof! Finalement non.")); response.notify("Bof! Finalement non.".to_string());
None None
} }
// Group actions // Group actions