Skip to content

Commit

Permalink
Remove some dead code in objects_from_file
Browse files Browse the repository at this point in the history
Since #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.
  • Loading branch information
roblabla committed Jan 3, 2024
1 parent 0b4ce30 commit 1316b84
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3839,13 +3839,6 @@ fn objects_from_files(files: &[Arc<Path>], dst: &Path) -> Result<Vec<Object>, 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)?,
Expand Down

0 comments on commit 1316b84

Please sign in to comment.