From fc1754fbfa78157719bbe51af286cd4f714fbd88 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Mon, 17 Apr 2023 15:13:27 +0200 Subject: [PATCH] thanks clippy --- src/rust/preproc/src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/rust/preproc/src/main.rs b/src/rust/preproc/src/main.rs index 46f660d1c1..37a4194281 100644 --- a/src/rust/preproc/src/main.rs +++ b/src/rust/preproc/src/main.rs @@ -13,15 +13,15 @@ fn main() { }; let mut output = String::with_capacity(2048); - let url_base = std::env::var("URL_BASE").unwrap_or(String::new()); + let url_base = std::env::var("URL_BASE").unwrap_or_default(); // FIXME: for urls starting with /, use only the netloc let url_base = url_base - .strip_suffix("/") + .strip_suffix('/') .map(String::from) .unwrap_or(url_base); fn fix_url<'a>(base: &str, url: CowStr<'a>) -> CowStr<'a> { - if url.starts_with("/") { + if url.starts_with('/') { format!("{base}{url}").into() } else if url.starts_with("..") { format!("{base}/{url}").into()