From d178e35c34a9106dd6c0a86286ff56dc8b297942 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 17 May 2021 18:52:12 +0300 Subject: Make clippy happy --- src/frontend/mod.rs | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'src/frontend') diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index eefc257..029c5dc 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -8,25 +8,24 @@ static POSTS_PER_PAGE: usize = 20; mod templates { use super::IndiewebEndpoints; - use chrono; use ellipse::Ellipse; use http_types::StatusCode; use log::error; /// Return a pretty location specifier from a geo: URI. fn decode_geo_uri(uri: &str) -> String { - if let Some(part) = uri.split(":").collect::>().get(1) { - if let Some(part) = part.split(";").next() { - let mut parts = part.split(","); + if let Some(part) = uri.split(':').collect::>().get(1) { + if let Some(part) = part.split(';').next() { + let mut parts = part.split(','); let lat = parts.next().unwrap(); let lon = parts.next().unwrap(); // TODO - format them as proper latitude and longitude return format!("{}, {}", lat, lon); } else { - return uri.to_string(); + uri.to_string() } } else { - return uri.to_string(); + uri.to_string() } } @@ -379,7 +378,7 @@ mod templates { @markup::raw(post["properties"]["content"][0]["html"].as_str().unwrap().trim()) } } - @WebInteractions { post: post } + @WebInteractions { post } } } PhotoGallery<'a>(photos: Option<&'a Vec>) { @@ -689,11 +688,11 @@ pub async fn onboarding_receiver(mut req: Request(mut req: Request(_: Request>) -> Result { Err(FrontendError::with_code( StatusCode::ImATeapot, "Someone asked this website to brew them some coffee...", - ))?; - return Ok(Response::builder(500).build()); // unreachable + ).into()) } pub async fn mainpage(req: Request>) -> Result { @@ -796,7 +794,7 @@ pub async fn mainpage(req: Request>) -> Result { ) .build()) } else { - Err(feed_err)? + return Err(feed_err.into()) } } else { Ok(Response::builder(200) @@ -850,10 +848,10 @@ pub async fn render_post(req: Request>) -> Resul "h-entry" => templates::Entry { post: &post }.to_string(), "h-card" => templates::VCard { card: &post }.to_string(), "h-feed" => templates::Feed { feed: &post }.to_string(), - _ => Err(FrontendError::with_code( + _ => return Err(FrontendError::with_code( StatusCode::InternalServerError, "Couldn't render an unknown type", - ))?, + ).into()), }; Ok(Response::builder(200) -- cgit 1.4.1