Skip to content

Commit

Permalink
? after unsafe
Browse files Browse the repository at this point in the history
  • Loading branch information
orion GONZALEZ (contractor) committed Oct 18, 2023
1 parent 41ee596 commit 6b64e37
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/replacer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ impl Replacer {

let source = File::open(path)?;
let meta = fs::metadata(path)?;
let mmap_source = unsafe { Mmap::map(&source)? };
let mmap_source = unsafe { Mmap::map(&source) }?;
let replaced = self.replace(&mmap_source);

let target = tempfile::NamedTempFile::new_in(
Expand All @@ -179,7 +179,7 @@ impl Replacer {
file.set_permissions(meta.permissions())?;

if !replaced.is_empty() {
let mut mmap_target = unsafe { MmapMut::map_mut(file)? };
let mut mmap_target = unsafe { MmapMut::map_mut(file) }?;
mmap_target.deref_mut().write_all(&replaced)?;
mmap_target.flush_async()?;
}
Expand Down

0 comments on commit 6b64e37

Please sign in to comment.