File tree Expand file tree Collapse file tree 5 files changed +5
-6
lines changed Expand file tree Collapse file tree 5 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ fn mmap(path: &Path) -> Option<Mmap> {
188
188
let len = file. metadata ( ) . ok ( ) ?. len ( ) . try_into ( ) . ok ( ) ?;
189
189
// SAFETY: All files we mmap are mmaped by the dynamic linker or the kernel already for the
190
190
// executable code of the process. Modifying them would cause crashes or UB anyways.
191
- unsafe { Mmap :: map ( & file, len, 0 ) }
191
+ unsafe { Mmap :: map ( file, len, 0 ) }
192
192
}
193
193
194
194
cfg_if:: cfg_if! {
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ impl Mapping {
71
71
// NOTE: we map the remainder of the entire archive instead of just the library so we don't have to determine its length
72
72
// SAFETY: See `super::mmap` function
73
73
let map = unsafe {
74
- super :: mmap:: Mmap :: map ( & file, usize:: try_from ( len - zip_offset) . ok ( ) ?, zip_offset)
74
+ super :: mmap:: Mmap :: map ( file, usize:: try_from ( len - zip_offset) . ok ( ) ?, zip_offset)
75
75
} ?;
76
76
77
77
Mapping :: mk ( map, |map, stash| {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ impl Mmap {
12
12
///
13
13
/// # Safety
14
14
/// This function is always safe to call.
15
- pub unsafe fn map ( mut file : & File , len : usize , offset : u64 ) -> Option < Mmap > {
15
+ pub unsafe fn map ( mut file : File , len : usize , offset : u64 ) -> Option < Mmap > {
16
16
let mut mmap = Mmap {
17
17
vec : Vec :: with_capacity ( len) ,
18
18
} ;
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ impl Mmap {
22
22
/// - Mapped files must not be altered for the lifetime of the returned value.
23
23
///
24
24
/// [^1]: https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/functions/mmap.html
25
- pub unsafe fn map ( file : & File , len : usize , offset : u64 ) -> Option < Mmap > {
25
+ pub unsafe fn map ( file : File , len : usize , offset : u64 ) -> Option < Mmap > {
26
26
let ptr = mmap64 (
27
27
ptr:: null_mut ( ) ,
28
28
len,
Original file line number Diff line number Diff line change @@ -23,8 +23,7 @@ impl Mmap {
23
23
/// - Mapped files must not be altered for the lifetime of the returned value.'
24
24
///
25
25
/// [^1]: https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-mapviewoffile
26
- pub unsafe fn map ( file : & File , len : usize , offset : u64 ) -> Option < Mmap > {
27
- let file = file. try_clone ( ) . ok ( ) ?;
26
+ pub unsafe fn map ( file : File , len : usize , offset : u64 ) -> Option < Mmap > {
28
27
let mapping = CreateFileMappingA (
29
28
file. as_raw_handle ( ) ,
30
29
ptr:: null_mut ( ) ,
You can’t perform that action at this time.
0 commit comments