From 27d00055df8691a6bd99aaf38633a7338b16cc6a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 11 Jul 2026 16:33:05 +0900 Subject: chore: use fully-qualified name for Rc/RefCell --- crates/shirabe/src/command/base_command.rs | 71 +++++++++++++++++------------- 1 file changed, 41 insertions(+), 30 deletions(-) (limited to 'crates/shirabe/src/command/base_command.rs') diff --git a/crates/shirabe/src/command/base_command.rs b/crates/shirabe/src/command/base_command.rs index 33864964..b80cb2b4 100644 --- a/crates/shirabe/src/command/base_command.rs +++ b/crates/shirabe/src/command/base_command.rs @@ -30,8 +30,6 @@ use shirabe_php_shim::{ InvalidArgumentException, LogicException, PhpMixed, RuntimeException, UnexpectedValueException, count, explode, in_array, is_string, }; -use std::cell::RefCell; -use std::rc::Rc; pub const SUCCESS: i64 = 0; pub const FAILURE: i64 = 1; @@ -42,16 +40,16 @@ pub const INVALID: i64 = 2; #[derive(Debug)] pub struct BaseCommandData { inner: CommandData, - pub(crate) composer: RefCell>, - pub(crate) io: RefCell>>>, + pub(crate) composer: std::cell::RefCell>, + pub(crate) io: std::cell::RefCell>>>, } impl BaseCommandData { pub fn new(name: Option) -> Self { BaseCommandData { inner: CommandData::new(name), - composer: RefCell::new(None), - io: RefCell::new(None), + composer: std::cell::RefCell::new(None), + io: std::cell::RefCell::new(None), } } @@ -152,15 +150,15 @@ pub trait BaseCommand: Command { /// Removes the cached composer instance fn reset_composer(&self) -> anyhow::Result<()>; - fn get_io(&self) -> Rc>; + fn get_io(&self) -> std::rc::Rc>; - fn set_io(&self, io: Rc>); + fn set_io(&self, io: std::rc::Rc>); /// Calls {@see Factory::create()} with the given arguments, taking into account flags and default states for disabling scripts and plugins fn create_composer_instance( &self, - input: Rc>, - io: Rc>, + input: std::rc::Rc>, + io: std::rc::Rc>, config: Option>, disable_plugins: bool, disable_scripts: Option, @@ -170,14 +168,14 @@ pub trait BaseCommand: Command { fn get_preferred_install_options( &self, config: &Config, - input: Rc>, + input: std::rc::Rc>, keep_vcs_requires_prefer_source: bool, ) -> anyhow::Result<(bool, bool)>; fn get_platform_requirement_filter( &self, - input: Rc>, - ) -> anyhow::Result>; + input: std::rc::Rc>, + ) -> anyhow::Result>; /// @param array $requirements /// @@ -196,7 +194,11 @@ pub trait BaseCommand: Command { ) -> anyhow::Result>>; /// @param array $table - fn render_table(&self, table: Vec, output: Rc>); + fn render_table( + &self, + table: Vec, + output: std::rc::Rc>, + ); fn get_terminal_width(&self) -> i64; @@ -205,7 +207,7 @@ pub trait BaseCommand: Command { /// @return Auditor::FORMAT_* fn get_audit_format( &self, - input: Rc>, + input: std::rc::Rc>, opt_name: &str, ) -> anyhow::Result; @@ -213,7 +215,7 @@ pub trait BaseCommand: Command { fn create_audit_config( &self, config: &mut Config, - input: Rc>, + input: std::rc::Rc>, ) -> anyhow::Result; } @@ -327,7 +329,7 @@ impl BaseCommand for BaseCommandData { Ok(()) } - fn get_io(&self) -> Rc> { + fn get_io(&self) -> std::rc::Rc> { if self.io.borrow().is_none() { match self.get_application() { Some(application) => { @@ -343,7 +345,8 @@ impl BaseCommand for BaseCommandData { *self.io.borrow_mut() = Some(io); } None => { - *self.io.borrow_mut() = Some(Rc::new(RefCell::new(NullIO::new()))); + *self.io.borrow_mut() = + Some(std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))); } } } @@ -351,14 +354,14 @@ impl BaseCommand for BaseCommandData { self.io.borrow().clone().unwrap() } - fn set_io(&self, io: Rc>) { + fn set_io(&self, io: std::rc::Rc>) { *self.io.borrow_mut() = Some(io); } fn create_composer_instance( &self, - input: Rc>, - io: Rc>, + input: std::rc::Rc>, + io: std::rc::Rc>, config: Option>, disable_plugins: bool, disable_scripts: Option, @@ -387,7 +390,7 @@ impl BaseCommand for BaseCommandData { fn get_preferred_install_options( &self, config: &Config, - input: Rc>, + input: std::rc::Rc>, keep_vcs_requires_prefer_source: bool, ) -> anyhow::Result<(bool, bool)> { let mut prefer_source = false; @@ -510,8 +513,8 @@ impl BaseCommand for BaseCommandData { fn get_platform_requirement_filter( &self, - input: Rc>, - ) -> anyhow::Result> { + input: std::rc::Rc>, + ) -> anyhow::Result> { if !input.borrow().has_option("ignore-platform-reqs") || !input.borrow().has_option("ignore-platform-req") { @@ -577,7 +580,11 @@ impl BaseCommand for BaseCommandData { parser.parse_name_version_pairs(requirements) } - fn render_table(&self, table: Vec, output: Rc>) { + fn render_table( + &self, + table: Vec, + output: std::rc::Rc>, + ) { let mut renderer = Table::new(output); renderer .set_style("compact".into()) @@ -604,7 +611,7 @@ impl BaseCommand for BaseCommandData { fn get_audit_format( &self, - input: Rc>, + input: std::rc::Rc>, opt_name: &str, ) -> anyhow::Result { if !input.borrow().has_option(opt_name) { @@ -641,7 +648,7 @@ impl BaseCommand for BaseCommandData { fn create_audit_config( &self, config: &mut Config, - input: Rc>, + input: std::rc::Rc>, ) -> anyhow::Result { // Handle both --audit and --no-audit flags let audit = if input.borrow().has_option("audit") { @@ -700,7 +707,11 @@ impl BaseCommand for BaseCommandData { /// (same for `getDisableScriptsByDefault()`), ORed into the caller's flags. fn apply_application_defaults( application: Option< - Rc>, + std::rc::Rc< + std::cell::RefCell< + dyn shirabe_external_packages::symfony::console::application::Application, + >, + >, >, mut disable_plugins: bool, mut disable_scripts: bool, @@ -725,8 +736,8 @@ fn apply_application_defaults( /// future overrides) bind correctly. pub fn base_command_initialize( cmd: &dyn BaseCommand, - input: Rc>, - _output: Rc>, + input: std::rc::Rc>, + _output: std::rc::Rc>, ) -> anyhow::Result<()> { // initialize a plugin-enabled Composer instance, either local or global let disable_plugins = input -- cgit v1.3.1