From 94c934996f575bff73ac6d1bb67e877854605ded Mon Sep 17 00:00:00 2001 From: Cyborus Date: Sun, 3 Nov 2024 23:13:59 -0500 Subject: chore: format --- src/prs.rs | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/prs.rs b/src/prs.rs index af7857f..43bfbf5 100644 --- a/src/prs.rs +++ b/src/prs.rs @@ -1609,13 +1609,22 @@ async fn guess_pr( let config = local_repo.config()?; let remote_head_name = config.get_string(&format!("branch.{local_branch_name}.merge"))?; - let maybe_agit = remote_head_name.strip_prefix("refs/for/").and_then(|s| s.split_once("/")); + let maybe_agit = remote_head_name + .strip_prefix("refs/for/") + .and_then(|s| s.split_once("/")); match maybe_agit { Some((base, head)) => { - let username = api.user_get_current().await?.login.ok_or_eyre("user does not have username")?.to_lowercase(); + let username = api + .user_get_current() + .await? + .login + .ok_or_eyre("user does not have username")? + .to_lowercase(); let head = format!("{username}/{head}"); - return Ok(api.repo_get_pull_request_by_base_head(repo.owner(), repo.name(), base, &head).await?); + return Ok(api + .repo_get_pull_request_by_base_head(repo.owner(), repo.name(), base, &head) + .await?); } None => { let remote_head_short = remote_head_name @@ -1625,15 +1634,19 @@ async fn guess_pr( let this_repo = api.repo_get(repo.owner(), repo.name()).await?; - // check for PRs on the main branch first let base = this_repo .default_branch .as_deref() .ok_or_eyre("repo does not have default branch")?; if let Ok(pr) = api - .repo_get_pull_request_by_base_head(repo.owner(), repo.name(), base, remote_head_short) - .await + .repo_get_pull_request_by_base_head( + repo.owner(), + repo.name(), + base, + remote_head_short, + ) + .await { return Ok(pr); } @@ -1657,14 +1670,15 @@ async fn guess_pr( parent_base, &parent_remote_head_name, ) - .await + .await { return Ok(pr); } } // then iterate all branches - if let Some(pr) = find_pr_from_branch(repo.owner(), repo.name(), api, remote_head_short).await? + if let Some(pr) = + find_pr_from_branch(repo.owner(), repo.name(), api, remote_head_short).await? { return Ok(pr); } @@ -1673,7 +1687,8 @@ async fn guess_pr( let (parent_owner, parent_name) = repo_name_from_repo(parent)?; if let Some(pr) = - find_pr_from_branch(parent_owner, parent_name, api, &parent_remote_head_name).await? + find_pr_from_branch(parent_owner, parent_name, api, &parent_remote_head_name) + .await? { return Ok(pr); } -- cgit v1.2.3