Skip to content

Commit

Permalink
Remove unnecessary Result from return types
Browse files Browse the repository at this point in the history
Summary:
## This stack
This stack will perform many refactors and bring improvements to the cross-repo codebase.

## This diff
As title

Reviewed By: lmvasquezg

Differential Revision: D68706757

fbshipit-source-id: 15e02761824e652ec2d0499c4244e727fca9a0e1
  • Loading branch information
gustavoavena authored and facebook-github-bot committed Jan 28, 2025
1 parent 5a059bb commit a47cf3b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ where

// Builds the syncer that can be used for opposite sync direction.
// Note: doesn't support large-to-small as input right now
pub fn reverse(&self) -> Result<CommitSyncer<R>, Error> {
Ok(Self {
repos: self.repos.reverse()?,
pub fn reverse(&self) -> CommitSyncer<R> {
Self {
repos: self.repos.reverse(),
live_commit_sync_config: self.live_commit_sync_config.clone(),
scuba_sample: self.scuba_sample.clone(),
})
}
}

// ------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ where

// Let's first validate that the target bookmark is still working-copy equivalent to what the
// parent of the commit we'd like to sync
let backsyncer = commit_syncer.reverse()?;
let backsyncer = commit_syncer.reverse();
let mb_small_csid_equivalent_to_target_bookmark = backsyncer
.sync_commit(
ctx,
Expand Down Expand Up @@ -767,12 +767,11 @@ impl<R: Repo> CommitSyncRepos<R> {
// Builds the repos that can be used for opposite sync direction.
// Note: doesn't support large-to-small as input right now
// TODO(T182311609): stop returning a Result if there's no error.
pub fn reverse(&self) -> Result<Self> {
let clone = self.clone();
Ok(CommitSyncRepos {
pub fn reverse(&self) -> Self {
CommitSyncRepos {
sync_direction: self.sync_direction.reverse(),
..clone
})
..self.clone()
}
}

pub fn get_submodule_deps(&self) -> &SubmoduleDeps<R> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub async fn verify_working_copy_with_version<'a, R: Repo>(
source_repo,
target_root_fsnode_id,
source_root_fsnode_id,
commit_syncer.reverse()?,
commit_syncer.reverse(),
),
};
let submodules_action = get_git_submodule_action_by_version(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ pub(crate) async fn build_submodule_backsync_test_data(
vec![], // Known dangling submodule pointers
)
.await?;
let reverse_syncer = test_data.commit_syncer.reverse()?;
let reverse_syncer = test_data.commit_syncer.reverse();

Ok(SubmoduleSyncTestData {
commit_syncer: reverse_syncer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async fn test_verify_working_copy_with_submodules(fb: FacebookInit) -> Result<()
.await?;
verify_working_copy(
&ctx,
&commit_syncer.reverse()?,
&commit_syncer.reverse(),
large_repo_master,
live_commit_sync_config,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ async fn run_in_tailing_mode(
)
})?;
commit_syncer
.reverse()?
.reverse()
.sync_commit(
ctx,
target_bookmark_value,
Expand Down

0 comments on commit a47cf3b

Please sign in to comment.