about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-12-18 18:11:47 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-12-18 18:11:47 +0000
commit8521e700190b70fd11c7415ea2815c93e523d1df (patch)
treec58969e71985f9ad358a67df503cb07ad3c24ff3
parenta220a53af340c49b494f3230a930e1a019197df6 (diff)
downloadrust-8521e700190b70fd11c7415ea2815c93e523d1df.tar.gz
rust-8521e700190b70fd11c7415ea2815c93e523d1df.zip
Simplify RelPath implementation
-rw-r--r--build_system/path.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/build_system/path.rs b/build_system/path.rs
index 20a81156b71..d6a6558b2be 100644
--- a/build_system/path.rs
+++ b/build_system/path.rs
@@ -11,20 +11,11 @@ pub(crate) struct Dirs {
 
 #[doc(hidden)]
 #[derive(Debug, Copy, Clone)]
-pub(crate) enum PathBase {
+enum PathBase {
     Source,
     Build,
 }
 
-impl PathBase {
-    fn to_path(self, dirs: &Dirs) -> PathBuf {
-        match self {
-            PathBase::Source => dirs.source_dir.clone(),
-            PathBase::Build => dirs.build_dir.clone(),
-        }
-    }
-}
-
 #[derive(Debug, Copy, Clone)]
 pub(crate) struct RelPath {
     base: PathBase,
@@ -41,6 +32,9 @@ impl RelPath {
     }
 
     pub(crate) fn to_path(&self, dirs: &Dirs) -> PathBuf {
-        self.base.to_path(dirs).join(self.suffix)
+        match self.base {
+            PathBase::Source => dirs.source_dir.join(self.suffix),
+            PathBase::Build => dirs.build_dir.join(self.suffix),
+        }
     }
 }