From cd25c3e193f05a5e89bca2a1c706c85fdc9c9155 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 02:13:59 +0900 Subject: refactor(repository): make read methods fallible and take &mut self Change RepositoryInterface and WritableRepositoryInterface read methods (find_package, find_packages, get_packages, load_packages, search, get_providers, get_canonical_packages) to take &mut self and return anyhow::Result, so lazy-loading repositories such as ComposerRepository can perform fallible I/O and mutate internal state on access. Update all implementors and call sites to propagate the Result and pass mutable references. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/require_command.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/command/require_command.rs') diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs index cfa7bba..e5ddbe7 100644 --- a/crates/shirabe/src/command/require_command.rs +++ b/crates/shirabe/src/command/require_command.rs @@ -337,7 +337,7 @@ impl RequireCommand { let found_packages: Vec = self .get_repos() - .find_packages(name, None) + .find_packages(name, None)? .into_iter() .map(|p| p.into()) .collect(); @@ -557,7 +557,7 @@ impl RequireCommand { composer .get_plugin_manager() .borrow_mut() - .deactivate_installed_plugins(); + .deactivate_installed_plugins()?; let io = self.get_io().clone(); let do_update_result = @@ -955,7 +955,7 @@ impl RequireCommand { let mut package = repo.find_package( package_name, crate::repository::FindPackageConstraint::String("*".to_string()), - ); + )?; while let Some(alias) = package.as_ref().and_then(|p| p.as_alias()) { package = Some(alias.get_alias_of().into()); } -- cgit v1.3.1