aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/html.rs11
-rw-r--r--src/main.rs8
-rw-r--r--src/response.rs20
3 files changed, 12 insertions, 27 deletions
diff --git a/src/html.rs b/src/html.rs
index 0c88b2a..bdf4206 100644
--- a/src/html.rs
+++ b/src/html.rs
@@ -15,21 +15,14 @@
// Copyright (C) 2022-2023 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
-use std::env::var;
-
-use germ::ast::Node;
-use url::Url;
+use {germ::ast::Node, std::env::var, url::Url};
fn link_from_host_href(url: &Url, href: &str) -> Option<String> {
Some(format!(
"gemini://{}{}{}",
url.domain()?,
{
- if href.starts_with('/') {
- ""
- } else {
- "/"
- }
+ if href.starts_with('/') { "" } else { "/" }
},
href
))
diff --git a/src/main.rs b/src/main.rs
index a1ffb08..c56c9e0 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -31,13 +31,9 @@ mod html;
mod response;
mod url;
-#[macro_use]
-extern crate log;
+#[macro_use] extern crate log;
-use std::env::var;
-
-use actix_web::web;
-use response::default;
+use {actix_web::web, response::default, std::env::var};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
diff --git a/src/response.rs b/src/response.rs
index 7c71f55..d7142c4 100644
--- a/src/response.rs
+++ b/src/response.rs
@@ -15,11 +15,11 @@
// Copyright (C) 2022-2023 Fuwn <[email protected]>
// SPDX-License-Identifier: GPL-3.0-only
-use std::{env::var, time::Instant};
-
-use actix_web::{Error, HttpResponse};
-
-use crate::url::make as make_url;
+use {
+ crate::url::make as make_url,
+ actix_web::{Error, HttpResponse},
+ std::{env::var, time::Instant},
+};
#[allow(clippy::unused_async, clippy::future_not_send, clippy::too_many_lines)]
pub async fn default(
@@ -105,10 +105,8 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".<
.parameters()
.get("charset")
.map_or_else(|| "utf-8".to_string(), ToString::to_string);
- let language = meta
- .parameters()
- .get("lang")
- .map_or_else(String::new, ToString::to_string);
+ let language =
+ meta.parameters().get("lang").map_or_else(String::new, ToString::to_string);
// Reset timer for below
timer = Instant::now();
@@ -172,9 +170,7 @@ For example: to proxy "gemini://fuwn.me/uptime", visit "/proxy/fuwn.me/uptime".<
));
}
- if var("MATHJAX")
- .unwrap_or_else(|_| "true".to_string())
- .to_lowercase()
+ if var("MATHJAX").unwrap_or_else(|_| "true".to_string()).to_lowercase()
== "true"
{
html_context.push_str(