aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs/svn_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/svn_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/svn_driver.rs')
-rw-r--r--crates/shirabe/src/repository/vcs/svn_driver.rs47
1 files changed, 23 insertions, 24 deletions
diff --git a/crates/shirabe/src/repository/vcs/svn_driver.rs b/crates/shirabe/src/repository/vcs/svn_driver.rs
index b48ce99..6346a84 100644
--- a/crates/shirabe/src/repository/vcs/svn_driver.rs
+++ b/crates/shirabe/src/repository/vcs/svn_driver.rs
@@ -168,33 +168,32 @@ impl SvnDriver {
identifier: &str,
) -> Result<Option<IndexMap<String, PhpMixed>>> {
if !self.inner.info_cache.contains_key(identifier) {
- if self.should_cache(identifier) {
- if let Some(mut res) = self
+ if self.should_cache(identifier)
+ && let Some(mut res) = self
.inner
.cache
.as_mut()
.and_then(|c| c.read(&format!("{}.json", identifier)))
- {
- // old cache files had '' stored instead of null due to af3783b5f40bae32a23e353eaf0a00c9b8ce82e2, so we make sure here that we always return null or array
- // and fix outdated invalid cache files
- if res == "\"\"" {
- res = "null".to_string();
- self.inner
- .cache
- .as_mut()
- .unwrap()
- .write(&format!("{}.json", identifier), &res)?;
- }
-
- let parsed = JsonFile::parse_json(Some(res.as_str()), None)?;
- let composer: Option<IndexMap<String, PhpMixed>> = parsed
- .as_array()
- .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect());
+ {
+ // old cache files had '' stored instead of null due to af3783b5f40bae32a23e353eaf0a00c9b8ce82e2, so we make sure here that we always return null or array
+ // and fix outdated invalid cache files
+ if res == "\"\"" {
+ res = "null".to_string();
self.inner
- .info_cache
- .insert(identifier.to_string(), composer.clone());
- return Ok(composer);
+ .cache
+ .as_mut()
+ .unwrap()
+ .write(&format!("{}.json", identifier), &res)?;
}
+
+ let parsed = JsonFile::parse_json(Some(res.as_str()), None)?;
+ let composer: Option<IndexMap<String, PhpMixed>> = parsed
+ .as_array()
+ .map(|m| m.iter().map(|(k, v)| (k.clone(), (**v).clone())).collect());
+ self.inner
+ .info_cache
+ .insert(identifier.to_string(), composer.clone());
+ return Ok(composer);
}
let base_result =
@@ -290,7 +289,7 @@ impl SvnDriver {
return Err(e);
}
};
- if trim(&output, None) == "" {
+ if trim(&output, None).is_empty() {
return Ok(None);
}
@@ -506,14 +505,14 @@ impl SvnDriver {
}
// Subversion client 1.7 and older
- if stripos(&process.get_error_output(), "authorization failed:").is_some() {
+ if stripos(process.get_error_output(), "authorization failed:").is_some() {
// This is likely a remote Subversion repository that requires
// authentication. We will handle actual authentication later.
return Ok(true);
}
// Subversion client 1.8 and newer
- if stripos(&process.get_error_output(), "Authentication failed").is_some() {
+ if stripos(process.get_error_output(), "Authentication failed").is_some() {
// This is likely a remote Subversion or newer repository that requires
// authentication. We will handle actual authentication later.
return Ok(true);