From 35cf675c8724a2f3398da3147d491213a664f7d2 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 23 Dec 2023 21:36:24 -0500 Subject: [PATCH] Fix clippy. --- src/context/regular_link.rs | 2 +- src/intermediate/regular_link.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/context/regular_link.rs b/src/context/regular_link.rs index 2fe5a82..fc77598 100644 --- a/src/context/regular_link.rs +++ b/src/context/regular_link.rs @@ -32,7 +32,7 @@ render!(RenderRegularLink, IRegularLink, original, render_context, { .unwrap_or_else(|| "".to_owned()); Ok(RenderRegularLink { - target: target, + target, raw_link: original.raw_link.clone(), children, post_blank: original.post_blank, diff --git a/src/intermediate/regular_link.rs b/src/intermediate/regular_link.rs index 50a52a7..faab0a7 100644 --- a/src/intermediate/regular_link.rs +++ b/src/intermediate/regular_link.rs @@ -64,8 +64,8 @@ impl LinkTarget { let post_id = parsed.host_str().map(str::to_owned); let subpath = { let subpath = parsed.path(); - if subpath.starts_with('/') { - &subpath[1..] + if let Some(subpath) = subpath.strip_prefix('/') { + subpath } else { subpath }