Remove pointless copying.
This commit is contained in:
parent
1c3e2ca4d9
commit
884a28e63a
@ -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<P: AsRef<Path>>(
|
||||
async fn get_all_files<P: Into<PathBuf>>(
|
||||
root_dir: P,
|
||||
) -> 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
|
||||
.into_iter()
|
||||
.map(|entry| tokio::spawn(read_file(entry.path())));
|
||||
|
@ -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<P: AsRef<Path>>(
|
||||
pub(crate) async fn get_org_files<P: Into<PathBuf>>(
|
||||
root_dir: P,
|
||||
) -> 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
|
||||
.into_iter()
|
||||
.map(|entry| entry.path())
|
||||
|
Loading…
Reference in New Issue
Block a user