From e071ba1ed628f9b3b9cfb282f232c819524c1dc0 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 24 Jul 2024 00:39:31 +0000 Subject: style(response): clippy cleanup --- src/response.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/response.rs b/src/response.rs index 7b9a1d3..70c8811 100644 --- a/src/response.rs +++ b/src/response.rs @@ -8,12 +8,12 @@ use { const CSS: &str = include_str!("../default.css"); -#[allow(clippy::unused_async, clippy::future_not_send, clippy::too_many_lines)] +#[allow(clippy::future_not_send, clippy::too_many_lines)] pub async fn default( - req: actix_web::HttpRequest, + http_request: actix_web::HttpRequest, ) -> Result { if ["/proxy", "/proxy/", "/x", "/x/", "/raw", "/raw/", "/nocss", "/nocss/"] - .contains(&req.path()) + .contains(&http_request.path()) { return Ok( HttpResponse::Ok() @@ -26,10 +26,11 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".< let mut configuration = configuration::Configuration::new(); let url = match url_from_path( - &format!("{}{}", req.path(), { - if !req.query_string().is_empty() || req.uri().to_string().ends_with('?') + &format!("{}{}", http_request.path(), { + if !http_request.query_string().is_empty() + || http_request.uri().to_string().ends_with('?') { - format!("?{}", req.query_string()) + format!("?{}", http_request.query_string()) } else { String::new() } @@ -175,7 +176,7 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".< html_context.push_str(&format!("{gemini_title}")); html_context.push_str(""); - if !req.path().starts_with("/proxy") { + if !http_request.path().starts_with("/proxy") { if let Ok(header) = var("HEADER") { html_context .push_str(&format!("
{header}
")); @@ -236,8 +237,8 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".< if let Ok(plain_texts) = var("PLAIN_TEXT_ROUTE") { if plain_texts.split(',').any(|r| { - path_matches_pattern(r, req.path()) - || path_matches_pattern(r, req.path().trim_end_matches('/')) + path_matches_pattern(r, http_request.path()) + || path_matches_pattern(r, http_request.path().trim_end_matches('/')) }) { return Ok(HttpResponse::Ok().body( response.content().as_ref().map_or_else(String::default, String::clone), -- cgit v1.2.3