From 1316b84e8e247c891b45368df0435218ad11941d Mon Sep 17 00:00:00 2001 From: roblabla Date: Wed, 3 Jan 2024 12:36:08 +0100 Subject: [PATCH] Remove some dead code in objects_from_file Since https://github.com/rust-lang/cc-rs/pull/684 was merged, it is impossible for `obj` to not start with dst - if `obj` is absolute or contains `../` in its Path, then the path will be hashed, and the file will still be placed under dst. As such, this obj.starts_with(&dst) check is always true. --- src/lib.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index b317f48f3..0187ec7d0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3839,13 +3839,6 @@ fn objects_from_files(files: &[Arc], dst: &Path) -> Result, Er } else { dst.join(file).with_extension("o") }; - let obj = if !obj.starts_with(&dst) { - dst.join(obj.file_name().ok_or_else(|| { - Error::new(ErrorKind::IOError, "Getting object file details failed.") - })?) - } else { - obj - }; match obj.parent() { Some(s) => fs::create_dir_all(s)?,