From 89976b83f60ad7dfc83faec65f2c81d986733604 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 24 Oct 2023 13:44:03 +0200 Subject: [PATCH] clippy --- crates/api_common/src/utils.rs | 2 +- crates/utils/src/utils/markdown/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/api_common/src/utils.rs b/crates/api_common/src/utils.rs index ec3c74a30..7d49668f6 100644 --- a/crates/api_common/src/utils.rs +++ b/crates/api_common/src/utils.rs @@ -800,7 +800,7 @@ pub async fn process_markdown_opt( slur_regex: &Option, ) -> LemmyResult> { match text { - Some(t) => process_markdown(&t, slur_regex).await.map(Some), + Some(t) => process_markdown(t, slur_regex).await.map(Some), None => Ok(None), } } diff --git a/crates/utils/src/utils/markdown/mod.rs b/crates/utils/src/utils/markdown/mod.rs index e74b2a932..f4a6dc6db 100644 --- a/crates/utils/src/utils/markdown/mod.rs +++ b/crates/utils/src/utils/markdown/mod.rs @@ -52,7 +52,7 @@ pub fn markdown_rewrite_image_links(mut src: String) -> String { // Go through the collected links while let Some((start, end)) = links.pop() { - let url = &src[start..end]; + let url = &src.get(start..end).unwrap_or_default(); match Url::parse(url) { Ok(parsed) => { // If link points to remote domain, replace with proxied link