From 884a28e63adf3c3fcef84e73c425d2630c62fd82 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 17:28:50 -0400 Subject: [PATCH] Remove pointless copying. --- src/command/build/render.rs | 5 ++--- src/intermediate/blog_post.rs | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/command/build/render.rs b/src/command/build/render.rs index 6ffb7d8..5108ccd 100644 --- a/src/command/build/render.rs +++ b/src/command/build/render.rs @@ -1,5 +1,4 @@ use std::ffi::OsStr; -use std::path::Path; use std::path::PathBuf; use include_dir::include_dir; @@ -280,10 +279,10 @@ async fn filter_to_files(entry: &DirEntry) -> WalkFsFilterResult { unreachable!("Unhandled file type."); } -async fn get_all_files>( +async fn get_all_files>( root_dir: P, ) -> Result>, CustomError> { - let files = walk_fs(root_dir.as_ref(), filter_to_files).await?; + let files = walk_fs(root_dir, filter_to_files).await?; let files_and_content = files .into_iter() .map(|entry| tokio::spawn(read_file(entry.path()))); diff --git a/src/intermediate/blog_post.rs b/src/intermediate/blog_post.rs index 6f48864..adb8ac2 100644 --- a/src/intermediate/blog_post.rs +++ b/src/intermediate/blog_post.rs @@ -125,10 +125,10 @@ async fn read_file(path: PathBuf) -> std::io::Result<(PathBuf, String)> { Ok((path, contents)) } -pub(crate) async fn get_org_files>( +pub(crate) async fn get_org_files>( root_dir: P, ) -> Result>>, CustomError> { - let org_files = walk_fs(root_dir.as_ref(), filter_to_org_files).await?; + let org_files = walk_fs(root_dir, filter_to_org_files).await?; let org_files = org_files .into_iter() .map(|entry| entry.path())