Skip to content

Commit

Permalink
homebrew-bottles: avoid serilaize JSON twice
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed Aug 24, 2023
1 parent 0d25d46 commit f4cc798
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions homebrew-bottles/bottles-json/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::{
collections::HashSet,
fs::File,
io::Read,
io::{Read, Write},
path::{Path, PathBuf},
};

Expand Down Expand Up @@ -93,8 +93,8 @@ fn e(f: &Value, name: &str, target: &Path) -> Option<()> {
}

{
let file = File::create(target.join(tmp_name.clone())).unwrap();
serde_json::to_writer(file, f).unwrap();
let mut file = File::create(target.join(tmp_name.clone())).unwrap();
file.write_all(contents.as_bytes()).unwrap();
}
std::fs::rename(target.join(tmp_name), target.join(final_name)).unwrap();
Some(())
Expand Down

0 comments on commit f4cc798

Please sign in to comment.