Skip to content

Commit

Permalink
test(atomic_rewrite): close file before
Browse files Browse the repository at this point in the history
  • Loading branch information
marvin-j97 committed Dec 9, 2023
1 parent a6efdbb commit 8d33974
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ mod tests {
let dir = tempfile::tempdir()?;

let path = dir.path().join("test.txt");
let mut file = File::create(&path)?;
write!(file, "asdasdasdasdasd")?;
{
let mut file = File::create(&path)?;
write!(file, "asdasdasdasdasd")?;
}

rewrite_atomic(&path, b"newcontent")?;

Expand Down

0 comments on commit 8d33974

Please sign in to comment.