aboutsummaryrefslogtreecommitdiff
path: root/src/url.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-02-04 02:01:43 +0000
committerFuwn <[email protected]>2023-02-04 02:01:43 +0000
commitccaaa2a41e744f59e3425ed5618fc00c3f9de80d (patch)
tree21c46f7a1f8aa6e198295ab4630dff9ecfcbc3b0 /src/url.rs
parentfix(gemini_to_html.rs): html entity-encode gemini (diff)
downloadseptember-ccaaa2a41e744f59e3425ed5618fc00c3f9de80d.tar.xz
september-ccaaa2a41e744f59e3425ed5618fc00c3f9de80d.zip
build(rustup): move from nightly to stable)
Diffstat (limited to 'src/url.rs')
-rw-r--r--src/url.rs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/url.rs b/src/url.rs
index 5100d44..1653335 100644
--- a/src/url.rs
+++ b/src/url.rs
@@ -66,16 +66,17 @@ pub fn make(
format!(
"{}{}{}",
{
- if let Ok(root) = std::env::var("ROOT") {
- root
- } else {
- warn!(
- "could not use ROOT from environment variables, proceeding with \
- default root: gemini://fuwn.me"
- );
+ std::env::var("ROOT").map_or_else(
+ |_| {
+ warn!(
+ "could not use ROOT from environment variables, proceeding \
+ with default root: gemini://fuwn.me"
+ );
- "gemini://fuwn.me".to_string()
- }
+ "gemini://fuwn.me".to_string()
+ },
+ |root| root,
+ )
},
path,
if fallback { "/" } else { "" }