From 894afaa75d45d39ecb73780b3e44942a7162a44d Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Thu, 27 Jul 2023 10:37:16 +0200 Subject: [PATCH] Fix or allow pedantic clippy lints --- src/error.rs | 6 ++---- src/lib.rs | 1 + src/main.rs | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/error.rs b/src/error.rs index 0f71446..4274a30 100644 --- a/src/error.rs +++ b/src/error.rs @@ -41,18 +41,16 @@ impl ResponseError for Error { fn error_response(&self) -> HttpResponse { let mut buf = Vec::new(); - match self { - Error::BranchNotFound => { + if let Error::BranchNotFound = self { templates::p404_no_master_html(&mut buf, VERSION_INFO, 0).unwrap(); HttpResponse::NotFound().content_type("text/html").body(buf) } - _ => { + else { templates::p500_html(&mut buf, VERSION_INFO, 0).unwrap(); HttpResponse::InternalServerError() .content_type("text/html") .body(buf) } - } } } diff --git a/src/lib.rs b/src/lib.rs index 0884d6e..709fd02 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -282,6 +282,7 @@ where } pull(&path)?; let (hoc, head, commits) = hoc(&service_url, &state.repos(), &state.cache(), branch)?; + #[allow(clippy::cast_precision_loss)] let hoc_pretty = match NumberPrefix::decimal(hoc as f64) { NumberPrefix::Standalone(hoc) => hoc.to_string(), NumberPrefix::Prefixed(prefix, hoc) => format!("{hoc:.1}{prefix}"), diff --git a/src/main.rs b/src/main.rs index b72aa5e..89f4201 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ fn init() { dotenvy::dotenv().ok(); openssl_probe::init_ssl_cert_env_vars(); - telemetry::init_subscriber(telemetry::get_subscriber("hoc", "info")) + telemetry::init_subscriber(telemetry::get_subscriber("hoc", "info")); } #[actix_rt::main]