Skip to content

Commit

Permalink
Remove None from Artifact::as_parts
Browse files Browse the repository at this point in the history
Summary: Preparation to remove `Option` from projected path everywhere in D64224117.

Reviewed By: JakobDegen

Differential Revision: D64203649

fbshipit-source-id: ad3f8545beafbca8d88e65a9b1d9560943040972
  • Loading branch information
stepancheg authored and facebook-github-bot committed Oct 11, 2024
1 parent 53bc258 commit dbc7d17
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/buck2_artifact/src/artifact/artifact_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ impl Artifact {
}
}

pub fn as_parts(&self) -> (&BaseArtifactKind, Option<&ForwardRelativePath>) {
pub fn as_parts(&self) -> (&BaseArtifactKind, &ForwardRelativePath) {
match self.0.data.key() {
ArtifactKind::Base(a) => (a, None),
ArtifactKind::Projected(a) => (a.base(), Some(a.path())),
ArtifactKind::Base(a) => (a, ForwardRelativePath::empty()),
ArtifactKind::Projected(a) => (a.base(), a.path()),
}
}

Expand All @@ -141,7 +141,7 @@ impl Artifact {

ArtifactPath {
base_path,
projected_path: projected_path.unwrap_or(ForwardRelativePath::empty()),
projected_path,
hidden_components_count: self.0.hidden_components_count,
}
}
Expand All @@ -160,10 +160,7 @@ impl Artifact {

let (base, already_projected) = self.as_parts();

let projected = already_projected
.unwrap_or(ForwardRelativePath::empty())
.to_owned()
.join(path);
let projected = already_projected.join(path);

Self::new(
base.dupe(),
Expand Down

0 comments on commit dbc7d17

Please sign in to comment.