Remove pointless copying.
All checks were successful
format Build format has succeeded
rust-test Build rust-test has succeeded
clippy Build clippy has succeeded

This commit is contained in:
Tom Alexander 2024-10-19 17:28:50 -04:00
parent 1c3e2ca4d9
commit 884a28e63a
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 4 additions and 5 deletions

View File

@ -1,5 +1,4 @@
use std::ffi::OsStr; use std::ffi::OsStr;
use std::path::Path;
use std::path::PathBuf; use std::path::PathBuf;
use include_dir::include_dir; use include_dir::include_dir;
@ -280,10 +279,10 @@ async fn filter_to_files(entry: &DirEntry) -> WalkFsFilterResult {
unreachable!("Unhandled file type."); unreachable!("Unhandled file type.");
} }
async fn get_all_files<P: AsRef<Path>>( async fn get_all_files<P: Into<PathBuf>>(
root_dir: P, root_dir: P,
) -> Result<impl Iterator<Item = JoinHandle<ReadFileResult>>, CustomError> { ) -> Result<impl Iterator<Item = JoinHandle<ReadFileResult>>, 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 let files_and_content = files
.into_iter() .into_iter()
.map(|entry| tokio::spawn(read_file(entry.path()))); .map(|entry| tokio::spawn(read_file(entry.path())));

View File

@ -125,10 +125,10 @@ async fn read_file(path: PathBuf) -> std::io::Result<(PathBuf, String)> {
Ok((path, contents)) Ok((path, contents))
} }
pub(crate) async fn get_org_files<P: AsRef<Path>>( pub(crate) async fn get_org_files<P: Into<PathBuf>>(
root_dir: P, root_dir: P,
) -> Result<impl Iterator<Item = JoinHandle<std::io::Result<(PathBuf, String)>>>, CustomError> { ) -> Result<impl Iterator<Item = JoinHandle<std::io::Result<(PathBuf, String)>>>, 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 let org_files = org_files
.into_iter() .into_iter()
.map(|entry| entry.path()) .map(|entry| entry.path())