Remove an unnecessary Path clone (#1153)

This commit is contained in:
Charlie Marsh 2024-01-27 19:16:51 -08:00 committed by GitHub
parent d243250dec
commit 888a9e6f53
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -111,13 +111,12 @@ pub fn unzip_archive<R: Send + std::io::Read + std::io::Seek + HasLength>(
let mut file = archive.by_index(file_number)?;
// Determine the path of the file within the wheel.
let file_path = match file.enclosed_name() {
Some(path) => path.to_owned(),
None => return Ok(()),
let Some(enclosed_name) = file.enclosed_name() else {
return Ok(());
};
// Create necessary parent directories.
let path = target.join(file_path);
let path = target.join(enclosed_name);
if file.is_dir() {
fs_err::create_dir_all(path)?;
return Ok(());