From 7ddc4011b3185f349f7fd2020dbf88310c79c3e6 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 19 Oct 2024 17:03:52 -0400 Subject: [PATCH] Use a type alias for read file results. --- src/command/build/render.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/command/build/render.rs b/src/command/build/render.rs index 530fba1..ef0a1aa 100644 --- a/src/command/build/render.rs +++ b/src/command/build/render.rs @@ -263,9 +263,11 @@ fn build_name_contents_pairs<'a>( Ok((name, contents)) } +type ReadFileResult = std::io::Result<(PathBuf, Vec)>; + fn get_all_files>( root_dir: P, -) -> Result)>>>, walkdir::Error> { +) -> Result>, walkdir::Error> { let files = WalkDir::new(root_dir) .into_iter() .filter(|e| match e { @@ -280,7 +282,7 @@ fn get_all_files>( Ok(org_files) } -async fn read_file(path: PathBuf) -> std::io::Result<(PathBuf, Vec)> { +async fn read_file(path: PathBuf) -> ReadFileResult { let contents = tokio::fs::read(&path).await?; Ok((path, contents)) }