Skip to content

Commit 3c2dde9

Browse files
authored
style: adhere to new clippy lint warning (#255)
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.
1 parent a1789a5 commit 3c2dde9

File tree

1 file changed

+3
-5
lines changed
  • cpp-linter/src/rest_api/github

1 file changed

+3
-5
lines changed

cpp-linter/src/rest_api/github/mod.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,15 @@ impl RestApiClient for GithubApiClient {
125125
lines_changed_only: &LinesChangedOnly,
126126
) -> Result<Vec<FileObj>> {
127127
if env::var("CI").is_ok_and(|val| val.as_str() == "true")
128-
&& self.repo.is_some()
129-
&& self.sha.is_some()
128+
&& let Some(repo) = self.repo.as_ref()
130129
{
131130
// get diff from Github REST API
132131
let is_pr = self.event_name == "pull_request";
133132
let pr = self.pull_request.to_string();
134-
let sha = self.sha.clone().unwrap();
133+
let sha = self.sha.clone().unwrap_or_default();
135134
let url = self
136135
.api_url
137-
.join("repos/")?
138-
.join(format!("{}/", self.repo.as_ref().unwrap()).as_str())?
136+
.join(format!("repos/{repo}/").as_str())?
139137
.join(if is_pr { "pulls/" } else { "commits/" })?
140138
.join(if is_pr { pr.as_str() } else { sha.as_str() })?;
141139
let mut diff_header = HeaderMap::new();

0 commit comments

Comments
 (0)