mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-30 06:43:20 +03:00
avoid holding the temp_dir for empty metadata file
This commit is contained in:
@@ -2158,7 +2158,7 @@ pub fn from_path(path: PathBuf, temp_dir: Option<MaybeTempDir>) -> std::io::Resu
|
||||
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 })
|
||||
|
||||
Reference in New Issue
Block a user