Skip to content

Commit

Permalink
Clarify code
Browse files Browse the repository at this point in the history
Co-authored-by: Guillaume Gomez <[email protected]>
  • Loading branch information
apiraino and GuillaumeGomez authored Mar 11, 2024
1 parent 9c88e4b commit 3e6590b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/handlers/pr_tracking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ pub(super) async fn parse_input(
}

// ... and if the action is an assignment or unassignment with an assignee
let (IssuesAction::Assigned { assignee: _ } | IssuesAction::Unassigned { assignee: _ }) =
&event.action
else {
return Ok(None);
};
Ok(Some(ReviewPrefsInput {}))
match event.action {
IssuesAction::Assigned { .. } | IssuesAction::Unassigned { .. } => Ok(Some(ReviewPrefsInput {})),
_ => Ok(None),
}
}

pub(super) async fn handle_input<'a>(
Expand All @@ -63,13 +61,13 @@ pub(super) async fn handle_input<'a>(
.await
.context("failed to record username")?;

if let IssuesAction::Unassigned { assignee: _ } = &event.action {
if matches!(event.action, IssuesAction::Unassigned { .. }) {
delete_pr_from_workqueue(&db_client, assignee.id.unwrap(), event.issue.number)
.await
.context("Failed to remove PR from workqueue")?;
}

if let IssuesAction::Assigned { assignee: _ } = &event.action {
if matches!(event.action, IssuesAction::Assigned { .. }) {
upsert_pr_into_workqueue(&db_client, assignee.id.unwrap(), event.issue.number)
.await
.context("Failed to add PR to workqueue")?;
Expand Down

0 comments on commit 3e6590b

Please sign in to comment.