From fd52e266c6e25999a49c36f17342977b759a2612 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 13 Mar 2022 15:20:03 +0100 Subject: apply clippy suggestions --- planetwars-server/src/routes/bots.rs | 4 ++-- planetwars-server/src/routes/demo.rs | 4 ++-- planetwars-server/src/routes/matches.rs | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'planetwars-server/src/routes') diff --git a/planetwars-server/src/routes/bots.rs b/planetwars-server/src/routes/bots.rs index c9bf8ce..f7f99cb 100644 --- a/planetwars-server/src/routes/bots.rs +++ b/planetwars-server/src/routes/bots.rs @@ -59,8 +59,8 @@ pub async fn save_bot( owner_id: None, name: ¶ms.bot_name, }; - let bot = bots::create_bot(&new_bot, &conn).expect("could not create bot"); - bot + + bots::create_bot(&new_bot, &conn).expect("could not create bot") } }; let _code_bundle = diff --git a/planetwars-server/src/routes/demo.rs b/planetwars-server/src/routes/demo.rs index 749c0ca..eb7f61f 100644 --- a/planetwars-server/src/routes/demo.rs +++ b/planetwars-server/src/routes/demo.rs @@ -13,8 +13,8 @@ use std::path::PathBuf; use super::matches::ApiMatch; -const PYTHON_IMAGE: &'static str = "python:3.10-slim-buster"; -const OPPONENT_NAME: &'static str = "simplebot"; +const PYTHON_IMAGE: &str = "python:3.10-slim-buster"; +const OPPONENT_NAME: &str = "simplebot"; #[derive(Serialize, Deserialize, Debug)] pub struct SubmitBotParams { diff --git a/planetwars-server/src/routes/matches.rs b/planetwars-server/src/routes/matches.rs index 9fa532e..991a4b5 100644 --- a/planetwars-server/src/routes/matches.rs +++ b/planetwars-server/src/routes/matches.rs @@ -57,8 +57,7 @@ pub async fn play_match( code_path: PathBuf::from(BOTS_DIR).join(code_bundle.path), image: "python:3.10-slim-buster".to_string(), argv: shlex::split(&bot_config.run_command) - // TODO: this is an user error, should ideally be handled before we get here - .ok_or_else(|| StatusCode::INTERNAL_SERVER_ERROR)?, + .ok_or(StatusCode::INTERNAL_SERVER_ERROR)?, }), }); @@ -152,7 +151,7 @@ pub async fn get_match_data( ) -> Result, StatusCode> { let match_data = matches::find_match(match_id, &conn) .map_err(|_| StatusCode::NOT_FOUND) - .map(|data| match_data_to_api(data))?; + .map(match_data_to_api)?; Ok(Json(match_data)) } -- cgit v1.2.3