repo_path: remove unused functions

This commit is contained in:
Martin von Zweigbergk 2021-05-16 23:50:21 -07:00
parent c66990d3a3
commit 57d2bc4068

View file

@ -102,16 +102,6 @@ impl RepoPath {
self.dir.to_internal_dir_string() + self.basename.value()
}
pub fn to_dir_repo_path(&self) -> DirRepoPath {
if self.is_root() {
DirRepoPath::root()
} else {
self.dir.join(&DirRepoPathComponent {
value: self.basename.value.clone(),
})
}
}
pub fn to_fs_path(&self, base: &Path) -> PathBuf {
let mut result = base.to_owned();
for dir in self.dir.components() {
@ -189,14 +179,6 @@ impl DirRepoPath {
result
}
pub fn contains_dir(&self, other: &DirRepoPath) -> bool {
other.value.starts_with(&self.value)
}
pub fn contains_file(&self, other: &RepoPath) -> bool {
other.dir.value.starts_with(&self.value)
}
// TODO: consider making this return a Option<DirRepoPathSlice> or similar,
// where the slice would borrow from this instance.
pub fn parent(&self) -> Option<DirRepoPath> {
@ -439,17 +421,4 @@ mod tests {
Path::new("dir/file")
);
}
#[test]
fn test_convert() {
assert_eq!(RepoPath::root().to_dir_repo_path(), DirRepoPath::root());
assert_eq!(
RepoPath::from_internal_string("dir").to_dir_repo_path(),
DirRepoPath::from_internal_dir_string("dir/")
);
assert_eq!(
RepoPath::from_internal_string("dir/subdir").to_dir_repo_path(),
DirRepoPath::from_internal_dir_string("dir/subdir/")
);
}
}