From e1e404947c5cabeb186698da9231125acf9ed895 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 2 Dec 2024 18:51:12 -0800 Subject: [PATCH] clippy --- lychee-lib/src/types/file.rs | 1 - lychee-lib/src/utils/path.rs | 4 ++-- lychee-lib/src/utils/request.rs | 12 ++++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lychee-lib/src/types/file.rs b/lychee-lib/src/types/file.rs index 7cdeff6c80..d2f8631c6c 100644 --- a/lychee-lib/src/types/file.rs +++ b/lychee-lib/src/types/file.rs @@ -54,7 +54,6 @@ impl> From

for FileType { } /// Helper function to check if a path is likely a URL. - fn is_url(path: &Path) -> bool { path.to_str() .and_then(|s| Url::parse(s).ok()) diff --git a/lychee-lib/src/utils/path.rs b/lychee-lib/src/utils/path.rs index 3d86259157..daa4f7fde6 100644 --- a/lychee-lib/src/utils/path.rs +++ b/lychee-lib/src/utils/path.rs @@ -36,7 +36,7 @@ pub(crate) fn resolve( relative if dst.is_relative() => { // Find `dst` in the parent directory of `src` let Some(parent) = src.parent() else { - return Err(ErrorKind::InvalidFile(relative.to_path_buf())); + return Err(ErrorKind::InvalidFile(relative.clone())); }; parent.join(relative) } @@ -46,7 +46,7 @@ pub(crate) fn resolve( } PathBuf::from(absolute) } - _ => return Err(ErrorKind::InvalidFile(dst.to_path_buf())), + _ => return Err(ErrorKind::InvalidFile(dst.clone())), }; Ok(Some(absolute_path(resolved))) } diff --git a/lychee-lib/src/utils/request.rs b/lychee-lib/src/utils/request.rs index d5e002f162..7f45ed8e7a 100644 --- a/lychee-lib/src/utils/request.rs +++ b/lychee-lib/src/utils/request.rs @@ -140,18 +140,18 @@ pub(crate) fn create( base: &Option, extractor: &Option, ) -> HashSet { - let base = base.clone().or_else(|| Base::from_source(&source)); + let base = base.clone().or_else(|| Base::from_source(source)); uris.into_iter() - .filter_map(|raw_uri| { - match create_request(&raw_uri, &source, &root_path, &base, extractor) { + .filter_map( + |raw_uri| match create_request(&raw_uri, source, root_path, &base, extractor) { Ok(request) => Some(request), Err(e) => { warn!("Error creating request: {:?}", e); None } - } - }) + }, + ) .collect() } @@ -197,7 +197,7 @@ fn prepend_root_path_if_absolute_local_link(text: &str, root_path: &Option