Skip to content

Commit

Permalink
git: remove PartialEq requirement from GitPushError
Browse files Browse the repository at this point in the history
Non-trivial error types usually don't implement Eq/PartialEq.
  • Loading branch information
yuja authored and thoughtpolice committed Jan 10, 2025
1 parent ce6119a commit f14a6e6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ pub fn fetch(
Ok(stats)
}

#[derive(Error, Debug, PartialEq)]
#[derive(Error, Debug)]
pub enum GitPushError {
#[error("No git remote named '{0}'")]
NoSuchRemote(String),
Expand Down
16 changes: 8 additions & 8 deletions lib/tests/test_git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2979,7 +2979,7 @@ fn test_push_bookmarks_success() {
&targets,
git::RemoteCallbacks::default(),
);
assert_eq!(result, Ok(()));
assert_matches!(result, Ok(()));

// Check that the ref got updated in the source repo
let source_repo = git2::Repository::open(&setup.source_repo_dir).unwrap();
Expand Down Expand Up @@ -3048,7 +3048,7 @@ fn test_push_bookmarks_deletion() {
&targets,
git::RemoteCallbacks::default(),
);
assert_eq!(result, Ok(()));
assert_matches!(result, Ok(()));

// Check that the ref got deleted in the source repo
assert!(source_repo.find_reference("refs/heads/main").is_err());
Expand Down Expand Up @@ -3105,7 +3105,7 @@ fn test_push_bookmarks_mixed_deletion_and_addition() {
&targets,
git::RemoteCallbacks::default(),
);
assert_eq!(result, Ok(()));
assert_matches!(result, Ok(()));

// Check that the topic ref got updated in the source repo
let source_repo = git2::Repository::open(&setup.source_repo_dir).unwrap();
Expand Down Expand Up @@ -3164,7 +3164,7 @@ fn test_push_bookmarks_not_fast_forward() {
&targets,
git::RemoteCallbacks::default(),
);
assert_eq!(result, Ok(()));
assert_matches!(result, Ok(()));

// Check that the ref got updated in the source repo
let source_repo = git2::Repository::open(&setup.source_repo_dir).unwrap();
Expand Down Expand Up @@ -3238,7 +3238,7 @@ fn test_push_updates_unexpectedly_moved_sideways_on_remote() {
);

// Moving the bookmark to the same place it already is is OK.
assert_eq!(
assert_matches!(
attempt_push_expecting_sideways(Some(setup.main_commit.id().clone())),
Ok(())
);
Expand Down Expand Up @@ -3300,7 +3300,7 @@ fn test_push_updates_unexpectedly_moved_forward_on_remote() {

// Moving the bookmark *forwards* is OK, as an exception matching our bookmark
// conflict resolution rules
assert_eq!(
assert_matches!(
attempt_push_expecting_parent(Some(setup.child_of_main_commit.id().clone())),
Ok(())
);
Expand Down Expand Up @@ -3342,7 +3342,7 @@ fn test_push_updates_unexpectedly_exists_on_remote() {
);

// We *can* move the bookmark forward even if we didn't expect it to exist
assert_eq!(
assert_matches!(
attempt_push_expecting_absence(Some(setup.child_of_main_commit.id().clone())),
Ok(())
);
Expand All @@ -3365,7 +3365,7 @@ fn test_push_updates_success() {
}],
git::RemoteCallbacks::default(),
);
assert_eq!(result, Ok(()));
assert_matches!(result, Ok(()));

// Check that the ref got updated in the source repo
let source_repo = git2::Repository::open(&setup.source_repo_dir).unwrap();
Expand Down

0 comments on commit f14a6e6

Please sign in to comment.