From 1c098a99d66c996ca399d09525447c939d842ffc Mon Sep 17 00:00:00 2001 From: Enola Knezevic Date: Fri, 15 Mar 2024 15:48:50 +0100 Subject: [PATCH] as clippy wanted --- src/errors.rs | 4 +--- src/main.rs | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 57701fd..7c8d170 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -2,8 +2,6 @@ use thiserror::Error; #[derive(Error, Debug)] pub enum PrismError { - #[error("Configuration error: {0}")] - ConfigurationError(String), #[error("Parsing error: {0}")] ParsingError(String), #[error("Beam error: {0}")] @@ -13,5 +11,5 @@ pub enum PrismError { #[error("Decode error: {0}")] DecodeError(base64::DecodeError), #[error("Unexpected WorkStatus: {0:?}")] - UnexpectedWorkStatusError(beam_lib::WorkStatus), + UnexpectedWorkStatus(beam_lib::WorkStatus), } diff --git a/src/main.rs b/src/main.rs index 66604cf..463cf53 100644 --- a/src/main.rs +++ b/src/main.rs @@ -269,11 +269,11 @@ async fn get_results(shared_state: SharedState, task_id: MsgId, wait_count: usiz while let Some(Ok(async_sse::Event::Message(msg))) = stream.next().await { let (from, measure_report) = match decode_result(&msg) { Ok(v) => v, - Err(PrismError::UnexpectedWorkStatusError(beam_lib::WorkStatus::Claimed)) => { + Err(PrismError::UnexpectedWorkStatus(beam_lib::WorkStatus::Claimed)) => { info!("Task claimed:) {msg:?}"); continue; } - Err(PrismError::UnexpectedWorkStatusError( + Err(PrismError::UnexpectedWorkStatus( beam_lib::WorkStatus::PermFailed | beam_lib::WorkStatus::TempFailed, )) => { warn!("WorkStatus PermFailed: {msg:?}"); @@ -308,7 +308,7 @@ fn decode_result(msg: &async_sse::Message) -> Result<(AppId, MeasureReport), Pri beam_lib::WorkStatus::Succeeded => {} yep => { // claimed not an error!!!! - return Err(PrismError::UnexpectedWorkStatusError(yep)); + return Err(PrismError::UnexpectedWorkStatus(yep)); } } let decoded = BASE64 @@ -324,7 +324,7 @@ async fn wait_for_beam_proxy() -> beam_lib::Result<()> { const MAX_RETRIES: u8 = 3; let mut tries = 1; loop { - match reqwest::get(format!("{}v1/health", CONFIG.beam_proxy_url.to_string())).await { + match reqwest::get(format!("{}v1/health", CONFIG.beam_proxy_url)).await { //FIXME why doesn't it work with url from config Ok(res) if res.status() == StatusCode::OK => return Ok(()), _ if tries <= MAX_RETRIES => tries += 1,