From e068a9d644fde6659a88accd55b3f1d0d9d7cf46 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 23 May 2026 03:07:15 +0900 Subject: refactor(promise): rewrite promise bodies to async/await Mechanically convert promise-returning function bodies to async/await: resolve() returns the value directly, forwarding calls get .await, and simple .then chains become await sequences. Also collapse the installer double-Option (Result>> -> Result>). Hard spots that depend on the Loop::wait / job-machine boundary (accept/reject orchestration, closures capturing &mut self, batch waits) are left intact and marked with TODO(phase-c-promise) for manual porting. The crate does not compile yet; traits still need #[async_trait]. Co-Authored-By: Claude Opus 4.7 --- crates/shirabe/src/installer/project_installer.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'crates/shirabe/src/installer/project_installer.rs') diff --git a/crates/shirabe/src/installer/project_installer.rs b/crates/shirabe/src/installer/project_installer.rs index 1c50a16..034a07a 100644 --- a/crates/shirabe/src/installer/project_installer.rs +++ b/crates/shirabe/src/installer/project_installer.rs @@ -64,7 +64,7 @@ impl InstallerInterface for ProjectInstaller { self.download_manager .borrow() .download(package, install_path, prev_package) - .map(Some) + .await } async fn prepare( @@ -76,7 +76,7 @@ impl InstallerInterface for ProjectInstaller { self.download_manager .borrow() .prepare(r#type, package, &self.install_path, prev_package) - .map(Some) + .await } async fn cleanup( @@ -88,7 +88,7 @@ impl InstallerInterface for ProjectInstaller { self.download_manager .borrow() .cleanup(r#type, package, &self.install_path, prev_package) - .map(Some) + .await } async fn install( @@ -96,11 +96,10 @@ impl InstallerInterface for ProjectInstaller { _repo: &mut dyn InstalledRepositoryInterface, package: &dyn PackageInterface, ) -> anyhow::Result> { - Ok(Some( - self.download_manager - .borrow() - .install(package, &self.install_path)?, - )) + self.download_manager + .borrow() + .install(package, &self.install_path) + .await } async fn update( -- cgit v1.3.1