Skip to content

Commit

Permalink
Use buffered writes for JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarx committed Dec 15, 2023
1 parent 7bc58f8 commit 98b6635
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions helpers/rust/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::{
fmt::Display,
fs::{metadata, File},
hash::Hash,
io::BufWriter,
path::PathBuf,
};
use strum::Display;
Expand Down Expand Up @@ -244,8 +245,8 @@ impl Settings {
T: Serialize,
{
self.replace_data_file(data_file, |file| {
serde_json::to_writer(file, value)
.context(format!("Failed to serialise data file {}", data_file))
serde_json::to_writer(BufWriter::new(file), value)
.context(format!("Failed to serialise data file {data_file}"))
})
}

Expand Down

0 comments on commit 98b6635

Please sign in to comment.