aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs/git_driver.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-20 01:16:50 +0900
committernsfisis <nsfisis@gmail.com>2026-06-20 02:22:41 +0900
commitefec43b3b8827820cf35fe1b73d8e33f5fe84eb4 (patch)
treea62bbba72324de48be5f8e689559f8d9e288fc61 /crates/shirabe/src/repository/vcs/git_driver.rs
parentcac18ef73a39b4ac41fa4d6ccb753804d4c42cb7 (diff)
downloadphp-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.gz
php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.tar.zst
php-shirabe-efec43b3b8827820cf35fe1b73d8e33f5fe84eb4.zip
refactor: auto-fix clippy warnings
Diffstat (limited to 'crates/shirabe/src/repository/vcs/git_driver.rs')
-rw-r--r--crates/shirabe/src/repository/vcs/git_driver.rs47
1 files changed, 21 insertions, 26 deletions
diff --git a/crates/shirabe/src/repository/vcs/git_driver.rs b/crates/shirabe/src/repository/vcs/git_driver.rs
index 3c950bb..e639649 100644
--- a/crates/shirabe/src/repository/vcs/git_driver.rs
+++ b/crates/shirabe/src/repository/vcs/git_driver.rs
@@ -167,7 +167,7 @@ impl GitDriver {
None,
false,
));
- self.inner.cache.as_mut().map(|c| {
+ if let Some(c) = self.inner.cache.as_mut() {
c.set_read_only(
self.inner
.config
@@ -176,7 +176,7 @@ impl GitDriver {
.as_bool()
.unwrap_or(false),
)
- });
+ }
Ok(())
}
@@ -215,11 +215,11 @@ impl GitDriver {
for branch in &branches {
if !branch.is_empty() {
let mut caps: IndexMap<CaptureKey, String> = IndexMap::new();
- if Preg::match3(r"{^\* +(\S+)}", branch, Some(&mut caps)) {
- if let Some(name) = caps.get(&CaptureKey::ByIndex(1)) {
- self.root_identifier = Some(name.clone());
- break;
- }
+ if Preg::match3(r"{^\* +(\S+)}", branch, Some(&mut caps))
+ && let Some(name) = caps.get(&CaptureKey::ByIndex(1))
+ {
+ self.root_identifier = Some(name.clone());
+ break;
}
}
}
@@ -338,16 +338,14 @@ impl GitDriver {
r"{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}",
&tag,
Some(&mut caps),
+ ) && let (Some(hash), Some(name)) = (
+ caps.get(&CaptureKey::ByIndex(1)),
+ caps.get(&CaptureKey::ByIndex(2)),
) {
- if let (Some(hash), Some(name)) = (
- caps.get(&CaptureKey::ByIndex(1)),
- caps.get(&CaptureKey::ByIndex(2)),
- ) {
- self.tags
- .as_mut()
- .unwrap()
- .insert(name.clone(), hash.clone());
- }
+ self.tags
+ .as_mut()
+ .unwrap()
+ .insert(name.clone(), hash.clone());
}
}
}
@@ -379,15 +377,12 @@ impl GitDriver {
r"{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}",
&branch,
Some(&mut caps),
- ) {
- if let (Some(name), Some(hash)) = (
- caps.get(&CaptureKey::ByIndex(1)),
- caps.get(&CaptureKey::ByIndex(2)),
- ) {
- if !name.starts_with('-') {
- branches.insert(name.clone(), hash.clone());
- }
- }
+ ) && let (Some(name), Some(hash)) = (
+ caps.get(&CaptureKey::ByIndex(1)),
+ caps.get(&CaptureKey::ByIndex(2)),
+ ) && !name.starts_with('-')
+ {
+ branches.insert(name.clone(), hash.clone());
}
}
}
@@ -430,7 +425,7 @@ impl GitDriver {
return Ok(true);
}
GitUtil::check_for_repo_ownership_error(
- &process.borrow().get_error_output(),
+ process.borrow().get_error_output(),
&url,
Some(io.clone()),
)?;