mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
avoid holding the temp_dir for empty metadata file
This commit is contained in:
parent
3e309350d2
commit
ea0e0f4e13
@ -2158,7 +2158,7 @@ impl EncodedMetadata {
|
||||
let file = std::fs::File::open(&path)?;
|
||||
let file_metadata = file.metadata()?;
|
||||
if file_metadata.len() == 0 {
|
||||
return Ok(Self { mmap: None, _temp_dir: temp_dir });
|
||||
return Ok(Self { mmap: None, _temp_dir: None });
|
||||
}
|
||||
let mmap = unsafe { Some(Mmap::map(file)?) };
|
||||
Ok(Self { mmap, _temp_dir: temp_dir })
|
||||
|
Loading…
Reference in New Issue
Block a user