fix safety hint

This commit is contained in:
timeshifter
2026-07-09 19:54:32 +02:00
parent b9e05f3cdf
commit 929d6b3e7e
+2 -2
View File
@@ -3,11 +3,11 @@ use memmap2::MmapOptions;
fn main() { fn main() {
let file = std::fs::File::open("measurements.txt").unwrap(); let file = std::fs::File::open("measurements.txt").unwrap();
// SAFETY: we are not going to modify the file while the program is running. No lock required
// for now.
let mut datas = vec![]; let mut datas = vec![];
// SAFETY: we are not going to modify the file while the program is running. No lock required
// for now.
let mmap = unsafe { MmapOptions::new().map(&file) }.unwrap(); let mmap = unsafe { MmapOptions::new().map(&file) }.unwrap();
mmap.advise(memmap2::Advice::Sequential).unwrap(); mmap.advise(memmap2::Advice::Sequential).unwrap();