From fbcba37940f27e9c22df0901e6b3b737c26b4369 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 11 Jul 2026 16:37:32 +0900 Subject: fix(command-loader): return Rc> from get() CommandLoaderInterface::get() returned Box, which didn't match the Rc> Application::add() expects, leaving both call sites as todo!() panics. --- crates/shirabe/src/console/application.rs | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'crates/shirabe/src/console/application.rs') diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs index a2f36cf4..1a38f118 100644 --- a/crates/shirabe/src/console/application.rs +++ b/crates/shirabe/src/console/application.rs @@ -826,15 +826,9 @@ impl Application { && command_loader.has(name) { let command = command_loader.get(name); - // $this->add($this->commandLoader->get($name)) - // TODO(review): command_loader.get() returns Box while add() expects - // Rc>; the loader return type needs reconciliation. - let _ = command; return self .shared() - .add(todo!( - "std::rc::Rc> from command_loader.get(name)" - )) + .add(command) .map(|c| c.is_some()) .unwrap_or(false); } @@ -1034,9 +1028,7 @@ impl Application { if commands.len() > 1 { // $commandList = commandLoader ? array_merge(array_flip(loader->getNames()), commands) : commands // TODO(review): $commandList mixes flipped loader names (string => int) with - // SymfonyCommand - // instances; this heterogeneous PHP array needs a typed representation. The alias - // de-duplication and the loader->get() lazy materialization are left to design. + // SymfonyCommand instances; this heterogeneous PHP array needs a typed representation. let mut command_list: IndexMap< String, std::rc::Rc>, @@ -1048,13 +1040,7 @@ impl Application { for name_or_alias in commands { if !command_list.contains_key(&name_or_alias) { let loaded = self.command_loader.as_ref().unwrap().get(&name_or_alias); - let _ = loaded; - command_list.insert( - name_or_alias.clone(), - todo!( - "std::rc::Rc> from command_loader.get(name_or_alias)" - ), - ); + command_list.insert(name_or_alias.clone(), loaded); } let command_name = command_list[&name_or_alias] -- cgit v1.3.1