Skip to content

Commit

Permalink
Remove unused contains_absolute_symlinks from LinkFarm
Browse files Browse the repository at this point in the history
  • Loading branch information
tesujimath committed Jun 25, 2024
1 parent 5726153 commit 96a38e0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 19 deletions.
12 changes: 1 addition & 11 deletions tests/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,13 @@ fn cwd() -> &'static Cwd {
pub struct LinkFarm {
cwd: &'static Cwd,
tempdir: TempDir,
contains_absolute_symlinks: bool,
}

impl LinkFarm {
pub fn new() -> Self {
Self {
cwd: cwd(),
tempdir: tempdir().unwrap(),
contains_absolute_symlinks: false,
}
}

Expand Down Expand Up @@ -150,13 +148,7 @@ impl LinkFarm {

// create symlink to absolute path in link farm
// note the reversed order of parameters
//
// also record that the farm now contains absolute symlinks
pub fn symlink_abs<P: AsRef<Path>, Q: AsRef<Path>>(
&mut self,
link: P,
original: Q,
) -> &mut Self {
pub fn symlink_abs<P: AsRef<Path>, Q: AsRef<Path>>(&self, link: P, original: Q) -> &Self {
let original = self.tempdir.path().join(original);
let link = self.tempdir.path().join(link);
if link.is_dir() {
Expand All @@ -165,8 +157,6 @@ impl LinkFarm {
symlink_file(original, link).unwrap()
}

self.contains_absolute_symlinks = true;

self
}

Expand Down
14 changes: 6 additions & 8 deletions tests/path_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,14 @@ fn test_real_parent_rel_indirect_symlinks_not_windows(path: &str, expected: &str
#[test_case("A/B/=a1", "A")]
#[test_case("A/B/=C", "A")]
fn test_real_parent_abs_symlinks(path: &str, expected: &str) {
let mut farm = LinkFarm::new();
let farm = LinkFarm::new();

farm.dir("A")
.dir("A/B")
.dir("A/C")
.file("A/B/b1")
.file("A/a1");

farm.symlink_abs("A/B/=b1", "A/B/b1")
.file("A/a1")
.symlink_abs("A/B/=b1", "A/B/b1")
.symlink_abs("A/B/=a1", "A/a1")
.symlink_abs("A/B/=C", "A/C");

Expand Down Expand Up @@ -341,15 +340,14 @@ fn test_is_real_root_not_rel_indirect_symlinks_not_windows(path: &str) {
#[test_case("A/B/=C")]
#[cfg(not(target_family = "windows"))]
fn test_is_real_root_not_abs_symlinks_not_windows(path: &str) {
let mut farm = LinkFarm::new();
let farm = LinkFarm::new();

farm.dir("A")
.dir("A/B")
.dir("A/C")
.file("A/B/b1")
.file("A/a1");

farm.symlink_abs("A/B/=b1", "A/B/b1")
.file("A/a1")
.symlink_abs("A/B/=b1", "A/B/b1")
.symlink_abs("A/B/=a1", "A/a1")
.symlink_abs("A/B/=C", "A/C");

Expand Down

0 comments on commit 96a38e0

Please sign in to comment.