From 1fe1cd3fe9da3f34d8529a0c4cc89fdc61af5065 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 17 May 2026 17:44:03 +0900 Subject: fix(compile): add dyn keyword to all trait object usages (E0782) Co-Authored-By: Claude Sonnet 4.6 --- crates/shirabe/src/repository/array_repository.rs | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 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 7bb7e81..5262b5e 100644 --- a/crates/shirabe/src/repository/array_repository.rs +++ b/crates/shirabe/src/repository/array_repository.rs @@ -31,10 +31,10 @@ use crate::repository::repository_interface::{ pub struct ArrayRepository { /// @var ?array // TODO(phase-b): RefCell models PHP's lazy init via getPackages()/count() under &self - pub(crate) packages: RefCell>>>, + pub(crate) packages: RefCell>>>, /// @var ?array indexed by package unique name and used to cache hasPackage calls - pub(crate) package_map: RefCell>>>, + pub(crate) package_map: RefCell>>>, } impl ArrayRepository { @@ -63,9 +63,9 @@ impl ArrayRepository { } .into()); } - // TODO(phase-b): convert Box to Box - let mut package: Box = - todo!("downcast Box to Box"); + // TODO(phase-b): convert Box to Box + let mut package: Box = + todo!("downcast Box to Box"); if self.packages.borrow().is_none() { self.initialize(); @@ -73,7 +73,7 @@ impl ArrayRepository { // TODO(phase-b): pass a reference to self, not a clone package.set_repository(todo!("self as Box"))?; - let aliased_package: Option> = + let aliased_package: Option> = if let Some(alias) = (package.as_any() as &dyn Any).downcast_ref::() { Some(alias.get_alias_of().clone_box()) } else { @@ -97,10 +97,10 @@ impl ArrayRepository { /// @return AliasPackage|CompleteAliasPackage pub(crate) fn create_alias_package( &self, - mut package: Box, + mut package: Box, alias: String, pretty_alias: String, - ) -> Box { + ) -> Box { while let Some(alias_pkg) = (package.as_any() as &dyn Any).downcast_ref::() { package = alias_pkg.get_alias_of().clone_box(); } @@ -173,7 +173,7 @@ impl RepositoryInterface for ArrayRepository { ) -> LoadPackagesResult { let packages = self.get_packages(); - let mut result: IndexMap> = IndexMap::new(); + let mut result: IndexMap> = IndexMap::new(); let mut names_found: IndexMap = IndexMap::new(); for package in &packages { if package_name_map.contains_key(package.get_name()) { @@ -231,7 +231,7 @@ impl RepositoryInterface for ArrayRepository { &self, name: String, constraint: FindPackageConstraint, - ) -> Option> { + ) -> Option> { let name = strtolower(&name); let constraint: Box = match constraint { @@ -259,7 +259,7 @@ impl RepositoryInterface for ArrayRepository { &self, name: String, constraint: Option, - ) -> Vec> { + ) -> Vec> { // normalize name let name = strtolower(&name); let mut packages = vec![]; @@ -377,7 +377,7 @@ impl RepositoryInterface for ArrayRepository { fn has_package(&self, package: &dyn PackageInterface) -> bool { if self.package_map.borrow().is_none() { - let mut map: IndexMap> = IndexMap::new(); + let mut map: IndexMap> = IndexMap::new(); for repo_package in self.get_packages() { map.insert(repo_package.get_unique_name(), repo_package); } @@ -419,7 +419,7 @@ impl RepositoryInterface for ArrayRepository { result } - fn get_packages(&self) -> Vec> { + fn get_packages(&self) -> Vec> { if self.packages.borrow().is_none() { self.initialize(); } -- cgit v1.3.1