From 5fab189f82379df3d92c49660ef53c42a2e21c59 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 8 Nov 2024 23:27:46 -0500 Subject: [PATCH] Run cargo fmt --- native/philomena/src/camo.rs | 4 ++-- native/philomena/src/markdown.rs | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/native/philomena/src/camo.rs b/native/philomena/src/camo.rs index 5a72b3f6..df47a2e8 100644 --- a/native/philomena/src/camo.rs +++ b/native/philomena/src/camo.rs @@ -1,8 +1,8 @@ +use base64::engine::general_purpose::URL_SAFE_NO_PAD; +use base64::Engine; use ring::hmac; use std::env; use url::Url; -use base64::Engine; -use base64::engine::general_purpose::URL_SAFE_NO_PAD; fn trusted_host(mut url: Url) -> Option { url.set_port(Some(443)).ok()?; diff --git a/native/philomena/src/markdown.rs b/native/philomena/src/markdown.rs index af976233..c92e6a0f 100644 --- a/native/philomena/src/markdown.rs +++ b/native/philomena/src/markdown.rs @@ -1,5 +1,5 @@ -use comrak::ComrakOptions; use crate::camo; +use comrak::ComrakOptions; use rustler::{MapIterator, Term}; use std::collections::HashMap; use std::env; @@ -19,19 +19,28 @@ fn common_options() -> ComrakOptions { options.extension.camoifier = Some(|s| camo::image_url(s).unwrap_or_else(|| String::from(""))); if let Ok(domains) = env::var("SITE_DOMAINS") { - options.extension.philomena_domains = Some(domains.split(',').map(|s| s.to_string()).collect::>()); + options.extension.philomena_domains = Some( + domains + .split(',') + .map(|s| s.to_string()) + .collect::>(), + ); } options } fn map_to_hashmap(map: Term) -> Option> { - Some(MapIterator::new(map)?.map(|(key, value)| { - let key: String = key.decode().unwrap_or_else(|_| String::from("")); - let value: String = value.decode().unwrap_or_else(|_| String::from("")); + Some( + MapIterator::new(map)? + .map(|(key, value)| { + let key: String = key.decode().unwrap_or_else(|_| String::from("")); + let value: String = value.decode().unwrap_or_else(|_| String::from("")); - (key, value) - }).collect()) + (key, value) + }) + .collect(), + ) } pub fn to_html(input: String, reps: Term) -> String {