Fix or allow pedantic clippy lints

This commit is contained in:
Valentin Brandl 2023-07-27 10:37:16 +02:00
parent 29710d9263
commit 894afaa75d
3 changed files with 4 additions and 5 deletions

View File

@ -41,19 +41,17 @@ impl ResponseError for Error {
fn error_response(&self) -> HttpResponse { fn error_response(&self) -> HttpResponse {
let mut buf = Vec::new(); let mut buf = Vec::new();
match self { if let Error::BranchNotFound = self {
Error::BranchNotFound => {
templates::p404_no_master_html(&mut buf, VERSION_INFO, 0).unwrap(); templates::p404_no_master_html(&mut buf, VERSION_INFO, 0).unwrap();
HttpResponse::NotFound().content_type("text/html").body(buf) HttpResponse::NotFound().content_type("text/html").body(buf)
} }
_ => { else {
templates::p500_html(&mut buf, VERSION_INFO, 0).unwrap(); templates::p500_html(&mut buf, VERSION_INFO, 0).unwrap();
HttpResponse::InternalServerError() HttpResponse::InternalServerError()
.content_type("text/html") .content_type("text/html")
.body(buf) .body(buf)
} }
} }
}
} }
impl std::error::Error for Error {} impl std::error::Error for Error {}

View File

@ -282,6 +282,7 @@ where
} }
pull(&path)?; pull(&path)?;
let (hoc, head, commits) = hoc(&service_url, &state.repos(), &state.cache(), branch)?; 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) { let hoc_pretty = match NumberPrefix::decimal(hoc as f64) {
NumberPrefix::Standalone(hoc) => hoc.to_string(), NumberPrefix::Standalone(hoc) => hoc.to_string(),
NumberPrefix::Prefixed(prefix, hoc) => format!("{hoc:.1}{prefix}"), NumberPrefix::Prefixed(prefix, hoc) => format!("{hoc:.1}{prefix}"),

View File

@ -6,7 +6,7 @@ fn init() {
dotenvy::dotenv().ok(); dotenvy::dotenv().ok();
openssl_probe::init_ssl_cert_env_vars(); 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] #[actix_rt::main]