compliance: Remove irrelevant case (#53936)

Finn Evers created

We will not be proceeding with this, thus removing it here to have less
variants.

Release Notes:

- N/A

Change summary

tooling/compliance/src/checks.rs | 40 ---------------------------------
1 file changed, 1 insertion(+), 39 deletions(-)

Detailed changes

tooling/compliance/src/checks.rs 🔗

@@ -5,7 +5,7 @@ use itertools::Itertools as _;
 use crate::{
     git::{CommitDetails, CommitList},
     github::{
-        CommitAuthor, GithubClient, GithubLogin, GithubUser, PullRequestComment, PullRequestData,
+        CommitAuthor, GithubClient, GithubLogin, PullRequestComment, PullRequestData,
         PullRequestReview, Repository, ReviewState,
     },
     report::Report,
@@ -18,7 +18,6 @@ const ZED_ZIPPY_GROUP_APPROVAL: &str = "@zed-industries/approved";
 pub enum ReviewSuccess {
     ApprovingComment(Vec<PullRequestComment>),
     CoAuthored(Vec<CommitAuthor>),
-    ExternalMergedContribution { merged_by: GithubUser },
     PullRequestReviewed(Vec<PullRequestReview>),
 }
 
@@ -35,9 +34,6 @@ impl ReviewSuccess {
                 .iter()
                 .map(|comment| format!("@{}", comment.user.login))
                 .collect_vec(),
-            Self::ExternalMergedContribution { merged_by } => {
-                vec![format!("@{}", merged_by.login)]
-            }
         };
 
         let reviewers = reviewers.into_iter().unique().collect_vec();
@@ -60,9 +56,6 @@ impl fmt::Display for ReviewSuccess {
             Self::ApprovingComment(_) => {
                 formatter.write_str("Approved by an organization approval comment")
             }
-            Self::ExternalMergedContribution { .. } => {
-                formatter.write_str("External merged contribution")
-            }
         }
     }
 }
@@ -72,7 +65,6 @@ pub enum ReviewFailure {
     // todo: We could still query the GitHub API here to search for one
     NoPullRequestFound,
     Unreviewed,
-    UnableToDetermineReviewer,
     Other(anyhow::Error),
 }
 
@@ -82,7 +74,6 @@ impl fmt::Display for ReviewFailure {
             Self::NoPullRequestFound => formatter.write_str("No pull request found"),
             Self::Unreviewed => formatter
                 .write_str("No qualifying organization approval found for the pull request"),
-            Self::UnableToDetermineReviewer => formatter.write_str("Could not determine reviewer"),
             Self::Other(error) => write!(formatter, "Failed to inspect review state: {error}"),
         }
     }
@@ -141,10 +132,6 @@ impl<'a> Reporter<'a> {
             return Ok(approval);
         }
 
-        // if let Some(approval) = self.check_external_merged_pr(pr_number).await? {
-        //     return Ok(approval);
-        // }
-
         Err(ReviewFailure::Unreviewed)
     }
 
@@ -181,31 +168,6 @@ impl<'a> Reporter<'a> {
         }
     }
 
-    #[allow(unused)]
-    async fn check_external_merged_pr(
-        &self,
-        pull_request: PullRequestData,
-    ) -> Result<Option<ReviewSuccess>, ReviewFailure> {
-        if let Some(user) = pull_request.user
-            && self
-                .github_client
-                .check_repo_write_permission(&Repository::ZED, &GithubLogin::new(user.login))
-                .await?
-                .not()
-        {
-            pull_request.merged_by.map_or(
-                Err(ReviewFailure::UnableToDetermineReviewer),
-                |merged_by| {
-                    Ok(Some(ReviewSuccess::ExternalMergedContribution {
-                        merged_by,
-                    }))
-                },
-            )
-        } else {
-            Ok(None)
-        }
-    }
-
     async fn check_approving_pull_request_review(
         &self,
         pull_request: &PullRequestData,