Skip to content

Commit 8c76fa2

Browse files
committed
use BufReader and BufWriter to read/write archive index files
1 parent 22d6494 commit 8c76fa2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/storage/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use path_slash::PathExt;
1414
use std::{
1515
collections::{HashMap, HashSet},
1616
ffi::OsStr,
17-
fmt, fs,
17+
fmt, fs, io,
1818
io::{self, Write},
1919
ops::RangeInclusive,
2020
path::{Path, PathBuf},
@@ -249,8 +249,7 @@ impl Storage {
249249
.join(&remote_index_path);
250250

251251
if local_index_path.exists() {
252-
let mut file = fs::File::open(local_index_path)?;
253-
archive_index::Index::load(&mut file)
252+
archive_index::Index::load(io::BufReader::new(fs::File::open(local_index_path)?))
254253
} else {
255254
let index_content = self.get(&remote_index_path, std::usize::MAX)?.content;
256255

0 commit comments

Comments
 (0)