From efec43b3b8827820cf35fe1b73d8e33f5fe84eb4 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 20 Jun 2026 01:16:50 +0900 Subject: refactor: auto-fix clippy warnings --- crates/shirabe/src/repository/array_repository.rs | 27 +++++++++-------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'crates/shirabe/src/repository/array_repository.rs') diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs index cfc804f..7f99c1c 100644 --- a/crates/shirabe/src/repository/array_repository.rs +++ b/crates/shirabe/src/repository/array_repository.rs @@ -46,13 +46,7 @@ impl ArrayRepository { "initialize failed to initialize the packages array" ); - self.packages - .borrow() - .as_ref() - .unwrap() - .iter() - .map(|p| p.clone()) - .collect() + self.packages.borrow().as_ref().unwrap().to_vec() } /// @param array $packages @@ -295,8 +289,8 @@ impl RepositoryInterface for ArrayRepository { }; for package in self.get_packages_internal() { - if name == package.get_name() { - if constraint.is_none() + if name == package.get_name() + && (constraint.is_none() || constraint.as_ref().unwrap().matches( &SimpleConstraint::new( "==".to_string(), @@ -304,10 +298,9 @@ impl RepositoryInterface for ArrayRepository { None, ) .into(), - ) - { - packages.push(package); - } + )) + { + packages.push(package); } } @@ -340,10 +333,10 @@ impl RepositoryInterface for ArrayRepository { if matches.contains_key(&name) { continue; } - if let Some(t) = &r#type { - if package.get_type() != *t { - continue; - } + if let Some(t) = &r#type + && package.get_type() != *t + { + continue; } let complete = package.as_complete(); -- cgit v1.3.1