Skip to content

Commit 8521e70

Browse files
committed
Simplify RelPath implementation
1 parent a220a53 commit 8521e70

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

build_system/path.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,11 @@ pub(crate) struct Dirs {
1111

1212
#[doc(hidden)]
1313
#[derive(Debug, Copy, Clone)]
14-
pub(crate) enum PathBase {
14+
enum PathBase {
1515
Source,
1616
Build,
1717
}
1818

19-
impl PathBase {
20-
fn to_path(self, dirs: &Dirs) -> PathBuf {
21-
match self {
22-
PathBase::Source => dirs.source_dir.clone(),
23-
PathBase::Build => dirs.build_dir.clone(),
24-
}
25-
}
26-
}
27-
2819
#[derive(Debug, Copy, Clone)]
2920
pub(crate) struct RelPath {
3021
base: PathBase,
@@ -41,6 +32,9 @@ impl RelPath {
4132
}
4233

4334
pub(crate) fn to_path(&self, dirs: &Dirs) -> PathBuf {
44-
self.base.to_path(dirs).join(self.suffix)
35+
match self.base {
36+
PathBase::Source => dirs.source_dir.join(self.suffix),
37+
PathBase::Build => dirs.build_dir.join(self.suffix),
38+
}
4539
}
4640
}

0 commit comments

Comments
 (0)