From c71e6b2c7b04922def9e243b0e5dbf06288f14f6 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Thu, 29 Jan 2026 23:01:22 -0800 Subject: [PATCH] style: adhere to new clippy lint warning Seems to be related to changes in lint rules for Rust v1.93. See [`unnecessary_unwrap`](https://rust-lang.github.io/rust-clippy/rust-1.93.0/index.html#unnecessary_unwrap) lint rule. --- cpp-linter/src/rest_api/github/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cpp-linter/src/rest_api/github/mod.rs b/cpp-linter/src/rest_api/github/mod.rs index 8a5c856..3e7a4fa 100644 --- a/cpp-linter/src/rest_api/github/mod.rs +++ b/cpp-linter/src/rest_api/github/mod.rs @@ -125,17 +125,15 @@ impl RestApiClient for GithubApiClient { lines_changed_only: &LinesChangedOnly, ) -> Result> { if env::var("CI").is_ok_and(|val| val.as_str() == "true") - && self.repo.is_some() - && self.sha.is_some() + && let Some(repo) = self.repo.as_ref() { // get diff from Github REST API let is_pr = self.event_name == "pull_request"; let pr = self.pull_request.to_string(); - let sha = self.sha.clone().unwrap(); + let sha = self.sha.clone().unwrap_or_default(); let url = self .api_url - .join("repos/")? - .join(format!("{}/", self.repo.as_ref().unwrap()).as_str())? + .join(format!("repos/{repo}/").as_str())? .join(if is_pr { "pulls/" } else { "commits/" })? .join(if is_pr { pr.as_str() } else { sha.as_str() })?; let mut diff_header = HeaderMap::new();