summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-04-23 11:19:58 +0300
committerLars Wirzenius <liw@liw.fi>2021-04-23 11:19:58 +0300
commit1f5d9aed39495980736f25bbd7ec01d5193494c0 (patch)
treed32f4af9ac94c7569246f20c1e91bc741e7c5fe4
parent28c1652e0fa61563def69343141ac6c06854eaa6 (diff)
downloadsummain-rs-1f5d9aed39495980736f25bbd7ec01d5193494c0.tar.gz
don't spawn blocking
-rw-r--r--src/lib.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index becc8f3..8dab917 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -64,7 +64,7 @@ impl ManifestEntry {
let m = symlink_metadata(path)?;
let hash = if m.is_file() {
let path = path.to_path_buf();
- Some(tokio::task::spawn_blocking(move || file_checksum(path)).await??)
+ Some(file_checksum(path).await?)
} else {
None
};
@@ -86,7 +86,7 @@ impl ManifestEntry {
}
}
-fn file_checksum(path: PathBuf) -> std::io::Result<String> {
+async fn file_checksum(path: PathBuf) -> std::io::Result<String> {
let mut hasher = Sha256::new();
let file = File::open(path)?;