Simplify RelPath implementation
This commit is contained in:
parent
a220a53af3
commit
8521e70019
1 changed files with 5 additions and 11 deletions
|
@ -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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue