From d94e3ec276cb2fd344b6243cdbe5a5c9f3c3613a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 4 Jul 2026 03:20:05 +0900 Subject: fix(create-project-command): split chained config.borrow_mut() calls install_project's fluent builder chain called config.borrow_mut() four times inline as method arguments. Rust extends every argument temporary's lifetime to the end of the enclosing statement, so the first borrow_mut() was still alive when the second one ran, panicking with "already borrowed". Compute each value into a local before the chain instead, matching the pattern already used in install/update/require/remove_command.rs. Co-Authored-By: Claude Sonnet 5 --- .../shirabe/src/command/create_project_command.rs | 46 ++++++++++------------ 1 file changed, 21 insertions(+), 25 deletions(-) (limited to 'crates') diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs index e63502a..755590f 100644 --- a/crates/shirabe/src/command/create_project_command.rs +++ b/crates/shirabe/src/command/create_project_command.rs @@ -458,6 +458,23 @@ impl CreateProjectCommand { .borrow_mut() .set_output_progress(!no_progress); + let optimize_autoloader = config + .borrow() + .get("optimize-autoloader") + .as_bool() + .unwrap_or(false); + let class_map_authoritative = config + .borrow() + .get("classmap-authoritative") + .as_bool() + .unwrap_or(false); + let apcu_autoloader = config + .borrow() + .get("apcu-autoloader") + .as_bool() + .unwrap_or(false); + let audit_config = self.create_audit_config(&mut config.borrow_mut(), input.clone())?; + let mut installer = Installer::create(io.clone(), &composer_handle); installer .set_prefer_source(prefer_source) @@ -471,31 +488,10 @@ impl CreateProjectCommand { .unwrap() .clone(), ) - .set_optimize_autoloader( - config - .borrow_mut() - .get("optimize-autoloader") - .as_bool() - .unwrap_or(false), - ) - .set_class_map_authoritative( - config - .borrow_mut() - .get("classmap-authoritative") - .as_bool() - .unwrap_or(false), - ) - .set_apcu_autoloader( - config - .borrow_mut() - .get("apcu-autoloader") - .as_bool() - .unwrap_or(false), - None, - ) - .set_audit_config( - self.create_audit_config(&mut config.borrow_mut(), input.clone())?, - ); + .set_optimize_autoloader(optimize_autoloader) + .set_class_map_authoritative(class_map_authoritative) + .set_apcu_autoloader(apcu_autoloader, None) + .set_audit_config(audit_config); if !composer.get_locker().borrow_mut().is_locked() { installer.set_update(true); -- cgit v1.3.1