aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-11 16:33:05 +0900
committernsfisis <nsfisis@gmail.com>2026-07-11 16:33:05 +0900
commit27d00055df8691a6bd99aaf38633a7338b16cc6a (patch)
tree4af17ccff5f8c2d09156fa62c559e60e3e683dac /crates
parent1ec2220def43e37e5a65b96dde93c19b493258f4 (diff)
downloadphp-shirabe-27d00055df8691a6bd99aaf38633a7338b16cc6a.tar.gz
php-shirabe-27d00055df8691a6bd99aaf38633a7338b16cc6a.tar.zst
php-shirabe-27d00055df8691a6bd99aaf38633a7338b16cc6a.zip
chore: use fully-qualified name for Rc/RefCell
Diffstat (limited to 'crates')
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/application.rs10
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/command.rs96
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs18
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/help_command.rs12
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/command/list_command.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs9
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/cursor.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs36
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/helper.rs11
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs32
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs26
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs36
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs42
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs6
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/table.rs18
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs5
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs48
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/style/output_style.rs23
-rw-r--r--crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs22
-rw-r--r--crates/shirabe-external-packages/src/symfony/finder/finder.rs9
-rw-r--r--crates/shirabe-php-shim/src/xml.rs37
-rw-r--r--crates/shirabe-php-shim/src/zip.rs7
-rw-r--r--crates/shirabe/src/advisory/auditor.rs10
-rw-r--r--crates/shirabe/src/command/about_command.rs10
-rw-r--r--crates/shirabe/src/command/archive_command.rs14
-rw-r--r--crates/shirabe/src/command/audit_command.rs10
-rw-r--r--crates/shirabe/src/command/base_command.rs71
-rw-r--r--crates/shirabe/src/command/bump_command.rs10
-rw-r--r--crates/shirabe/src/command/check_platform_reqs_command.rs10
-rw-r--r--crates/shirabe/src/command/clear_cache_command.rs10
-rw-r--r--crates/shirabe/src/command/create_project_command.rs6
-rw-r--r--crates/shirabe/src/command/depends_command.rs10
-rw-r--r--crates/shirabe/src/command/diagnose_command.rs6
-rw-r--r--crates/shirabe/src/command/dump_autoload_command.rs10
-rw-r--r--crates/shirabe/src/command/exec_command.rs14
-rw-r--r--crates/shirabe/src/command/fund_command.rs10
-rw-r--r--crates/shirabe/src/command/global_command.rs15
-rw-r--r--crates/shirabe/src/command/home_command.rs10
-rw-r--r--crates/shirabe/src/command/init_command.rs14
-rw-r--r--crates/shirabe/src/command/install_command.rs10
-rw-r--r--crates/shirabe/src/command/licenses_command.rs10
-rw-r--r--crates/shirabe/src/command/outdated_command.rs13
-rw-r--r--crates/shirabe/src/command/prohibits_command.rs10
-rw-r--r--crates/shirabe/src/command/reinstall_command.rs14
-rw-r--r--crates/shirabe/src/command/remove_command.rs10
-rw-r--r--crates/shirabe/src/command/repository_command.rs6
-rw-r--r--crates/shirabe/src/command/require_command.rs10
-rw-r--r--crates/shirabe/src/command/run_script_command.rs19
-rw-r--r--crates/shirabe/src/command/script_alias_command.rs10
-rw-r--r--crates/shirabe/src/command/search_command.rs10
-rw-r--r--crates/shirabe/src/command/self_update_command.rs10
-rw-r--r--crates/shirabe/src/command/show_command.rs10
-rw-r--r--crates/shirabe/src/command/status_command.rs10
-rw-r--r--crates/shirabe/src/command/suggests_command.rs10
-rw-r--r--crates/shirabe/src/command/update_command.rs10
-rw-r--r--crates/shirabe/src/command/validate_command.rs10
-rw-r--r--crates/shirabe/src/config.rs5
-rw-r--r--crates/shirabe/src/console/application.rs4
-rw-r--r--crates/shirabe/src/dependency_resolver/default_policy.rs10
-rw-r--r--crates/shirabe/src/dependency_resolver/pool_optimizer.rs5
-rw-r--r--crates/shirabe/src/dependency_resolver/rule.rs4
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_set.rs22
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_set_generator.rs12
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_set_iterator.rs8
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_watch_graph.rs8
-rw-r--r--crates/shirabe/src/dependency_resolver/rule_watch_node.rs8
-rw-r--r--crates/shirabe/src/dependency_resolver/solver.rs50
-rw-r--r--crates/shirabe/src/dependency_resolver/solver_problems_exception.rs11
-rw-r--r--crates/shirabe/src/filter/platform_requirement_filter/platform_requirement_filter_factory.rs15
-rw-r--r--crates/shirabe/src/installer/installation_manager.rs2
-rw-r--r--crates/shirabe/src/io/console_io.rs13
-rw-r--r--crates/shirabe/src/io/io_interface.rs4
-rw-r--r--crates/shirabe/src/package/handle.rs48
-rw-r--r--crates/shirabe/src/package/loader/validating_array_loader.rs13
-rw-r--r--crates/shirabe/src/package/package.rs3
-rw-r--r--crates/shirabe/src/plugin/plugin_interface.rs20
-rw-r--r--crates/shirabe/src/repository/array_repository.rs13
-rw-r--r--crates/shirabe/src/repository/handle.rs75
-rw-r--r--crates/shirabe/src/repository/vcs/vcs_driver_interface.rs6
-rw-r--r--crates/shirabe/src/util/error_handler.rs7
-rw-r--r--crates/shirabe/tests/advisory/auditor_test.rs34
-rw-r--r--crates/shirabe/tests/all_functional_test.rs5
-rw-r--r--crates/shirabe/tests/application_test.rs116
-rw-r--r--crates/shirabe/tests/autoload/autoload_generator_test.rs25
-rw-r--r--crates/shirabe/tests/cache_test.rs8
-rw-r--r--crates/shirabe/tests/command/archive_command_test.rs66
-rw-r--r--crates/shirabe/tests/common/config_stub.rs6
-rw-r--r--crates/shirabe/tests/common/http_downloader_mock.rs18
-rw-r--r--crates/shirabe/tests/common/io_mock.rs10
-rw-r--r--crates/shirabe/tests/common/process_executor_mock.rs11
-rw-r--r--crates/shirabe/tests/common/test_case.rs36
-rw-r--r--crates/shirabe/tests/composer_test.rs80
-rw-r--r--crates/shirabe/tests/config/json_config_source_test.rs4
-rw-r--r--crates/shirabe/tests/config_test.rs4
-rw-r--r--crates/shirabe/tests/dependency_resolver/pool_builder_test.rs10
-rw-r--r--crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs3
-rw-r--r--crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs20
-rw-r--r--crates/shirabe/tests/dependency_resolver/rule_set_test.rs28
-rw-r--r--crates/shirabe/tests/dependency_resolver/solver_test.rs38
-rw-r--r--crates/shirabe/tests/documentation_test.rs6
-rw-r--r--crates/shirabe/tests/downloader/archive_downloader_test.rs9
-rw-r--r--crates/shirabe/tests/downloader/download_manager_test.rs18
-rw-r--r--crates/shirabe/tests/downloader/file_downloader_test.rs31
-rw-r--r--crates/shirabe/tests/downloader/fossil_downloader_test.rs21
-rw-r--r--crates/shirabe/tests/downloader/git_downloader_test.rs20
-rw-r--r--crates/shirabe/tests/downloader/hg_downloader_test.rs21
-rw-r--r--crates/shirabe/tests/downloader/perforce_downloader_test.rs22
-rw-r--r--crates/shirabe/tests/downloader/xz_downloader_test.rs15
-rw-r--r--crates/shirabe/tests/downloader/zip_downloader_test.rs38
-rw-r--r--crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs25
-rw-r--r--crates/shirabe/tests/factory_test.rs4
-rw-r--r--crates/shirabe/tests/installer/binary_installer_test.rs11
-rw-r--r--crates/shirabe/tests/installer/installation_manager_test.rs28
-rw-r--r--crates/shirabe/tests/installer/installer_event_test.rs7
-rw-r--r--crates/shirabe/tests/installer/library_installer_test.rs31
-rw-r--r--crates/shirabe/tests/installer/metapackage_installer_test.rs5
-rw-r--r--crates/shirabe/tests/installer/suggested_packages_reporter_test.rs13
-rw-r--r--crates/shirabe/tests/installer_test.rs105
-rw-r--r--crates/shirabe/tests/io/console_io_test.rs55
-rw-r--r--crates/shirabe/tests/package/archiver/archive_manager_test.rs26
-rw-r--r--crates/shirabe/tests/package/loader/root_package_loader_test.rs32
-rw-r--r--crates/shirabe/tests/package/locker_test.rs31
-rw-r--r--crates/shirabe/tests/package/version/version_guesser_test.rs14
-rw-r--r--crates/shirabe/tests/package/version/version_selector_test.rs18
-rw-r--r--crates/shirabe/tests/question/strict_confirmation_question_test.rs6
-rw-r--r--crates/shirabe/tests/repository/artifact_repository_test.rs5
-rw-r--r--crates/shirabe/tests/repository/composer_repository_test.rs12
-rw-r--r--crates/shirabe/tests/repository/filesystem_repository_test.rs6
-rw-r--r--crates/shirabe/tests/repository/path_repository_test.rs11
-rw-r--r--crates/shirabe/tests/repository/repository_factory_test.rs9
-rw-r--r--crates/shirabe/tests/repository/repository_manager_test.rs22
-rw-r--r--crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs18
-rw-r--r--crates/shirabe/tests/repository/vcs/fossil_driver_test.rs7
-rw-r--r--crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs37
-rw-r--r--crates/shirabe/tests/repository/vcs/git_driver_test.rs32
-rw-r--r--crates/shirabe/tests/repository/vcs/github_driver_test.rs88
-rw-r--r--crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs25
-rw-r--r--crates/shirabe/tests/repository/vcs/hg_driver_test.rs22
-rw-r--r--crates/shirabe/tests/repository/vcs/perforce_driver_test.rs14
-rw-r--r--crates/shirabe/tests/repository/vcs/svn_driver_test.rs12
-rw-r--r--crates/shirabe/tests/repository/vcs_repository_test.rs13
-rw-r--r--crates/shirabe/tests/script/event_test.rs15
-rw-r--r--crates/shirabe/tests/util/auth_helper_test.rs17
-rw-r--r--crates/shirabe/tests/util/bitbucket_test.rs18
-rw-r--r--crates/shirabe/tests/util/config_validator_test.rs5
-rw-r--r--crates/shirabe/tests/util/forgejo_test.rs10
-rw-r--r--crates/shirabe/tests/util/git_test.rs15
-rw-r--r--crates/shirabe/tests/util/github_test.rs12
-rw-r--r--crates/shirabe/tests/util/gitlab_test.rs11
-rw-r--r--crates/shirabe/tests/util/http_downloader_test.rs10
-rw-r--r--crates/shirabe/tests/util/perforce_test.rs110
-rw-r--r--crates/shirabe/tests/util/process_executor_test.rs30
-rw-r--r--crates/shirabe/tests/util/remote_filesystem_test.rs62
-rw-r--r--crates/shirabe/tests/util/svn_test.rs42
159 files changed, 1646 insertions, 1511 deletions
diff --git a/crates/shirabe-external-packages/src/symfony/console/application.rs b/crates/shirabe-external-packages/src/symfony/console/application.rs
index 605851fe..03fb0ced 100644
--- a/crates/shirabe-external-packages/src/symfony/console/application.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/application.rs
@@ -6,8 +6,6 @@ use crate::symfony::console::completion::completion_suggestions::CompletionSugge
use crate::symfony::console::helper::helper_set::HelperSet;
use crate::symfony::console::input::input_definition::InputDefinition;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
/// `Symfony\Component\Console\Application` is a concrete class in PHP, but it is ported here as a
/// trait rather than a struct.
@@ -28,13 +26,13 @@ pub trait Application: std::fmt::Debug + shirabe_php_shim::AsAny {
fn all(
&mut self,
namespace: Option<&str>,
- ) -> anyhow::Result<IndexMap<String, Rc<RefCell<dyn Command>>>>;
+ ) -> anyhow::Result<IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>>;
- fn find(&mut self, name: &str) -> anyhow::Result<Rc<RefCell<dyn Command>>>;
+ fn find(&mut self, name: &str) -> anyhow::Result<std::rc::Rc<std::cell::RefCell<dyn Command>>>;
- fn get_definition(&mut self) -> Rc<RefCell<InputDefinition>>;
+ fn get_definition(&mut self) -> std::rc::Rc<std::cell::RefCell<InputDefinition>>;
- fn get_helper_set(&mut self) -> Rc<RefCell<HelperSet>>;
+ fn get_helper_set(&mut self) -> std::rc::Rc<std::cell::RefCell<HelperSet>>;
fn complete(
&mut self,
diff --git a/crates/shirabe-external-packages/src/symfony/console/command/command.rs b/crates/shirabe-external-packages/src/symfony/console/command/command.rs
index 527f0c54..81eb3c08 100644
--- a/crates/shirabe-external-packages/src/symfony/console/command/command.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/command/command.rs
@@ -12,8 +12,7 @@ use crate::symfony::console::input::input_option::InputOption;
use crate::symfony::console::output::output_interface::{self, OutputInterface};
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::cell::{Cell, Ref, RefCell};
-use std::rc::Rc;
+use std::cell::{Cell, Ref};
/// The base-class state of the PHP `Command` class.
///
@@ -28,22 +27,23 @@ use std::rc::Rc;
/// command does not lock the object, so a command can be re-entered (e.g. the help command
/// describing itself) without the borrow conflicts a `&mut self` design would cause.
pub struct CommandData {
- application: RefCell<Option<Rc<RefCell<dyn Application>>>>,
- name: RefCell<Option<String>>,
- process_title: RefCell<Option<String>>,
- aliases: RefCell<Vec<String>>,
- definition: RefCell<Option<InputDefinition>>,
+ application: std::cell::RefCell<Option<std::rc::Rc<std::cell::RefCell<dyn Application>>>>,
+ name: std::cell::RefCell<Option<String>>,
+ process_title: std::cell::RefCell<Option<String>>,
+ aliases: std::cell::RefCell<Vec<String>>,
+ definition: std::cell::RefCell<Option<InputDefinition>>,
hidden: Cell<bool>,
- help: RefCell<String>,
- description: RefCell<String>,
- full_definition: RefCell<Option<InputDefinition>>,
+ help: std::cell::RefCell<String>,
+ description: std::cell::RefCell<String>,
+ full_definition: std::cell::RefCell<Option<InputDefinition>>,
ignore_validation_errors: Cell<bool>,
// A callable(InputInterface, OutputInterface) -> i64.
- code:
- RefCell<Option<Box<dyn Fn(&mut dyn InputInterface, &mut dyn OutputInterface) -> PhpMixed>>>,
- synopsis: RefCell<IndexMap<String, String>>,
- usages: RefCell<Vec<String>>,
- helper_set: RefCell<Option<Rc<RefCell<HelperSet>>>>,
+ code: std::cell::RefCell<
+ Option<Box<dyn Fn(&mut dyn InputInterface, &mut dyn OutputInterface) -> PhpMixed>>,
+ >,
+ synopsis: std::cell::RefCell<IndexMap<String, String>>,
+ usages: std::cell::RefCell<Vec<String>>,
+ helper_set: std::cell::RefCell<Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>>,
}
impl CommandData {
@@ -81,22 +81,22 @@ impl CommandData {
/// virtual dispatch of `$this->configure()` from the parent constructor.
pub fn new(name: Option<String>) -> Self {
let this = CommandData {
- application: RefCell::new(None),
- name: RefCell::new(None),
- process_title: RefCell::new(None),
- aliases: RefCell::new(Vec::new()),
- definition: RefCell::new(Some(
+ application: std::cell::RefCell::new(None),
+ name: std::cell::RefCell::new(None),
+ process_title: std::cell::RefCell::new(None),
+ aliases: std::cell::RefCell::new(Vec::new()),
+ definition: std::cell::RefCell::new(Some(
InputDefinition::new(Vec::new()).expect("an empty InputDefinition cannot fail"),
)),
hidden: Cell::new(false),
- help: RefCell::new(String::new()),
- description: RefCell::new(String::new()),
- full_definition: RefCell::new(None),
+ help: std::cell::RefCell::new(String::new()),
+ description: std::cell::RefCell::new(String::new()),
+ full_definition: std::cell::RefCell::new(None),
ignore_validation_errors: Cell::new(false),
- code: RefCell::new(None),
- synopsis: RefCell::new(IndexMap::new()),
- usages: RefCell::new(Vec::new()),
- helper_set: RefCell::new(None),
+ code: std::cell::RefCell::new(None),
+ synopsis: std::cell::RefCell::new(IndexMap::new()),
+ usages: std::cell::RefCell::new(Vec::new()),
+ helper_set: std::cell::RefCell::new(None),
};
// PHP's __construct also derives the name from getDefaultName() when null and
@@ -345,8 +345,8 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny {
/// forgot to implement it (PHP throws LogicException — a programming error here).
fn execute(
&self,
- _input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
panic!("You must override the execute() method in the concrete command class.");
}
@@ -354,16 +354,16 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny {
/// Interacts with the user before the InputDefinition is validated.
fn interact(
&self,
- _input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) {
}
/// Initializes the command after the input has been bound and before it is validated.
fn initialize(
&self,
- _input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
Ok(())
}
@@ -387,8 +387,8 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny {
/// or that late binding breaks.
fn run(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
self.base_run(input, output)
}
@@ -399,8 +399,8 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny {
/// binding of `initialize`/`interact`/`execute` to the concrete command breaks.
fn base_run(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
// add the application arguments and options
self.merge_application_definition(true);
@@ -477,13 +477,16 @@ pub trait Command: std::fmt::Debug + shirabe_php_shim::AsAny {
fn is_enabled(&self) -> bool;
- fn set_application(&self, application: Option<Rc<RefCell<dyn Application>>>);
+ fn set_application(
+ &self,
+ application: Option<std::rc::Rc<std::cell::RefCell<dyn Application>>>,
+ );
- fn get_application(&self) -> Option<Rc<RefCell<dyn Application>>>;
+ fn get_application(&self) -> Option<std::rc::Rc<std::cell::RefCell<dyn Application>>>;
- fn set_helper_set(&self, helper_set: Rc<RefCell<HelperSet>>);
+ fn set_helper_set(&self, helper_set: std::rc::Rc<std::cell::RefCell<HelperSet>>);
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>>;
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>;
fn merge_application_definition(&self, merge_args: bool);
@@ -549,7 +552,10 @@ impl Command for CommandData {
true
}
- fn set_application(&self, application: Option<Rc<RefCell<dyn Application>>>) {
+ fn set_application(
+ &self,
+ application: Option<std::rc::Rc<std::cell::RefCell<dyn Application>>>,
+ ) {
*self.application.borrow_mut() = application.clone();
if let Some(application) = application {
self.set_helper_set(application.borrow_mut().get_helper_set());
@@ -560,15 +566,15 @@ impl Command for CommandData {
*self.full_definition.borrow_mut() = None;
}
- fn get_application(&self) -> Option<Rc<RefCell<dyn Application>>> {
+ fn get_application(&self) -> Option<std::rc::Rc<std::cell::RefCell<dyn Application>>> {
self.application.borrow().clone()
}
- fn set_helper_set(&self, helper_set: Rc<RefCell<HelperSet>>) {
+ fn set_helper_set(&self, helper_set: std::rc::Rc<std::cell::RefCell<HelperSet>>) {
*self.helper_set.borrow_mut() = Some(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.helper_set.borrow().clone()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs
index d64e4a99..5d8b1a98 100644
--- a/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/command/complete_command.rs
@@ -11,9 +11,7 @@ use crate::symfony::console::input::input_option::InputOption;
use crate::symfony::console::output::output_interface::OutputInterface;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
-use std::rc::Rc;
/// Responsible for providing the values to the shell completion.
#[derive(Debug)]
@@ -105,7 +103,7 @@ impl CompleteCommand {
&self,
completion_input: &CompletionInput,
_output: &dyn OutputInterface,
- ) -> Option<Rc<RefCell<dyn Command>>> {
+ ) -> Option<std::rc::Rc<std::cell::RefCell<dyn Command>>> {
// try { ... } catch (CommandNotFoundException $e) {}
let input_name = completion_input.get_first_argument()?;
@@ -144,14 +142,16 @@ impl CompleteCommand {
}
}
-fn get_class_of_command(command: &Rc<RefCell<dyn Command>>) -> String {
+fn get_class_of_command(command: &std::rc::Rc<std::cell::RefCell<dyn Command>>) -> String {
// LazyCommand is intentionally not ported.
// TODO: get_class() takes a PhpMixed but the command is a `dyn Command`; reflecting the
// concrete class name of a trait object requires a class-name hook on Command (Phase C).
todo!()
}
-fn get_definition_options(command: &Rc<RefCell<dyn Command>>) -> Vec<Rc<InputOption>> {
+fn get_definition_options(
+ command: &std::rc::Rc<std::cell::RefCell<dyn Command>>,
+) -> Vec<std::rc::Rc<InputOption>> {
command
.borrow()
.get_definition()
@@ -209,8 +209,8 @@ impl Command for CompleteCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
let _ = (input, output);
self.is_debug.set(shirabe_php_shim::filter_var_boolean(
@@ -224,8 +224,8 @@ impl Command for CompleteCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
// try { ... } catch (\Throwable $e) { ...; if ($output->isDebug()) { throw $e; } return 2; }
let result: anyhow::Result<i64> = (|| {
diff --git a/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs
index 8e2583e9..23ce06f7 100644
--- a/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/command/dump_completion_command.rs
@@ -10,9 +10,7 @@ use crate::symfony::console::input::input_interface::InputInterface;
use crate::symfony::console::input::input_option::InputOption;
use crate::symfony::console::output::output_interface::{self, OutputInterface};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
-use std::rc::Rc;
/// Dumps the completion script for the current shell.
#[derive(Debug)]
@@ -180,8 +178,8 @@ impl Command for DumpCompletionCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let command_name = shirabe_php_shim::basename(
&shirabe_php_shim::PHP_SERVER
diff --git a/crates/shirabe-external-packages/src/symfony/console/command/help_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/help_command.rs
index 8ef488f7..7c32a733 100644
--- a/crates/shirabe-external-packages/src/symfony/console/command/help_command.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/command/help_command.rs
@@ -14,15 +14,13 @@ use crate::symfony::console::input::input_interface::InputInterface;
use crate::symfony::console::input::input_option::InputOption;
use crate::symfony::console::output::output_interface::OutputInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
-use std::rc::Rc;
/// HelpCommand displays the help for a given command.
#[derive(Debug)]
pub struct HelpCommand {
inner: CommandData,
- command: RefCell<Option<Rc<RefCell<dyn Command>>>>,
+ command: std::cell::RefCell<Option<std::rc::Rc<std::cell::RefCell<dyn Command>>>>,
}
impl Deref for HelpCommand {
@@ -49,7 +47,7 @@ impl HelpCommand {
pub fn new() -> Self {
let command = HelpCommand {
inner: CommandData::new(None),
- command: RefCell::new(None),
+ command: std::cell::RefCell::new(None),
};
command
.configure()
@@ -57,7 +55,7 @@ impl HelpCommand {
command
}
- pub fn set_command(&self, command: Rc<RefCell<dyn Command>>) {
+ pub fn set_command(&self, command: std::rc::Rc<std::cell::RefCell<dyn Command>>) {
*self.command.borrow_mut() = Some(command);
}
@@ -135,8 +133,8 @@ impl Command for HelpCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
if self.command.borrow().is_none() {
let application = self.get_application().unwrap();
diff --git a/crates/shirabe-external-packages/src/symfony/console/command/list_command.rs b/crates/shirabe-external-packages/src/symfony/console/command/list_command.rs
index 4f6e9231..4153a20b 100644
--- a/crates/shirabe-external-packages/src/symfony/console/command/list_command.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/command/list_command.rs
@@ -14,9 +14,7 @@ use crate::symfony::console::input::input_interface::InputInterface;
use crate::symfony::console::input::input_option::InputOption;
use crate::symfony::console::output::output_interface::OutputInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
-use std::rc::Rc;
/// ListCommand displays the list of all available commands for the application.
#[derive(Debug)]
@@ -140,8 +138,8 @@ impl Command for ListCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let mut helper = DescriptorHelper::new();
let object = DescribableObject::Application(self.get_application().unwrap());
diff --git a/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs b/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs
index 512056aa..02938552 100644
--- a/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/completion/completion_suggestions.rs
@@ -2,7 +2,6 @@
use crate::symfony::console::completion::suggestion::Suggestion;
use crate::symfony::console::input::input_option::InputOption;
-use std::rc::Rc;
/// PHP union type `string|Suggestion` used by `suggestValue`/`suggestValues`.
#[derive(Debug)]
@@ -15,7 +14,7 @@ pub enum StringOrSuggestion {
#[derive(Debug)]
pub struct CompletionSuggestions {
value_suggestions: Vec<Suggestion>,
- option_suggestions: Vec<Rc<InputOption>>,
+ option_suggestions: Vec<std::rc::Rc<InputOption>>,
}
impl Default for CompletionSuggestions {
@@ -52,14 +51,14 @@ impl CompletionSuggestions {
}
/// Add a suggestion for an input option name.
- pub fn suggest_option(&mut self, option: Rc<InputOption>) -> &mut Self {
+ pub fn suggest_option(&mut self, option: std::rc::Rc<InputOption>) -> &mut Self {
self.option_suggestions.push(option);
self
}
/// Add multiple suggestions for input option names at once.
- pub fn suggest_options(&mut self, options: Vec<Rc<InputOption>>) -> &mut Self {
+ pub fn suggest_options(&mut self, options: Vec<std::rc::Rc<InputOption>>) -> &mut Self {
for option in options {
self.suggest_option(option);
}
@@ -67,7 +66,7 @@ impl CompletionSuggestions {
self
}
- pub fn get_option_suggestions(&self) -> &Vec<Rc<InputOption>> {
+ pub fn get_option_suggestions(&self) -> &Vec<std::rc::Rc<InputOption>> {
&self.option_suggestions
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/cursor.rs b/crates/shirabe-external-packages/src/symfony/console/cursor.rs
index 05439df0..3ed9e3c2 100644
--- a/crates/shirabe-external-packages/src/symfony/console/cursor.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/cursor.rs
@@ -2,18 +2,16 @@
use crate::symfony::console::output::OutputInterface;
use crate::symfony::console::output::output_interface;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct Cursor {
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
input: shirabe_php_shim::PhpResource,
}
impl Cursor {
pub fn new(
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
input: Option<shirabe_php_shim::PhpResource>,
) -> Self {
let input = input.unwrap_or(shirabe_php_shim::STDIN);
diff --git a/crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs b/crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs
index 33f6a8ec..63127266 100644
--- a/crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/descriptor/application_description.rs
@@ -5,13 +5,11 @@ use crate::symfony::console::command::command::Command;
use crate::symfony::console::exception::command_not_found_exception::CommandNotFoundException;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// @internal
#[derive(Debug)]
pub struct ApplicationDescription {
- application: Rc<RefCell<dyn Application>>,
+ application: std::rc::Rc<std::cell::RefCell<dyn Application>>,
namespace: Option<String>,
show_hidden: bool,
@@ -20,17 +18,17 @@ pub struct ApplicationDescription {
namespaces: Option<IndexMap<String, IndexMap<String, PhpMixed>>>,
/// @var array<string, Command>
- commands: Option<IndexMap<String, Rc<RefCell<dyn Command>>>>,
+ commands: Option<IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>>,
/// @var array<string, Command>
- aliases: Option<IndexMap<String, Rc<RefCell<dyn Command>>>>,
+ aliases: Option<IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>>,
}
impl ApplicationDescription {
pub const GLOBAL_NAMESPACE: &'static str = "_global";
pub fn new(
- application: Rc<RefCell<dyn Application>>,
+ application: std::rc::Rc<std::cell::RefCell<dyn Application>>,
namespace: Option<String>,
show_hidden: bool,
) -> Self {
@@ -53,7 +51,9 @@ impl ApplicationDescription {
}
/// @return Command[]
- pub fn get_commands(&mut self) -> &IndexMap<String, Rc<RefCell<dyn Command>>> {
+ pub fn get_commands(
+ &mut self,
+ ) -> &IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>> {
if self.commands.is_none() {
self.inspect_application();
}
@@ -62,7 +62,10 @@ impl ApplicationDescription {
}
/// @throws CommandNotFoundException
- pub fn get_command(&self, name: &str) -> anyhow::Result<Rc<RefCell<dyn Command>>> {
+ pub fn get_command(
+ &self,
+ name: &str,
+ ) -> anyhow::Result<std::rc::Rc<std::cell::RefCell<dyn Command>>> {
let in_commands = self
.commands
.as_ref()
@@ -144,13 +147,18 @@ impl ApplicationDescription {
fn sort_commands(
&self,
- commands: IndexMap<String, Rc<RefCell<dyn Command>>>,
- ) -> IndexMap<String, IndexMap<String, Rc<RefCell<dyn Command>>>> {
- let mut namespaced_commands: IndexMap<String, IndexMap<String, Rc<RefCell<dyn Command>>>> =
- IndexMap::new();
- let mut global_commands: IndexMap<String, Rc<RefCell<dyn Command>>> = IndexMap::new();
- let mut sorted_commands: IndexMap<String, IndexMap<String, Rc<RefCell<dyn Command>>>> =
+ commands: IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>,
+ ) -> IndexMap<String, IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>> {
+ let mut namespaced_commands: IndexMap<
+ String,
+ IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>,
+ > = IndexMap::new();
+ let mut global_commands: IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>> =
IndexMap::new();
+ let mut sorted_commands: IndexMap<
+ String,
+ IndexMap<String, std::rc::Rc<std::cell::RefCell<dyn Command>>>,
+ > = IndexMap::new();
for (name, command) in commands {
let key = self.application.borrow().extract_namespace(&name, Some(1));
if ["", Self::GLOBAL_NAMESPACE].contains(&key.as_str()) {
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
index d3731b1b..6fcbce8e 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/debug_formatter_helper.rs
@@ -4,8 +4,6 @@ use crate::symfony::console::helper::helper::Helper;
use crate::symfony::console::helper::helper_interface::HelperInterface;
use crate::symfony::console::helper::helper_set::HelperSet;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
const COLORS: [&str; 9] = [
"black", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "default",
@@ -163,11 +161,11 @@ impl DebugFormatterHelper {
}
impl HelperInterface for DebugFormatterHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs
index 83e946ca..d422f99f 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/descriptor_helper.rs
@@ -13,8 +13,6 @@ use crate::symfony::console::helper::helper_interface::HelperInterface;
use crate::symfony::console::helper::helper_set::HelperSet;
use crate::symfony::console::output::output_interface::OutputInterface;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
/// This class adds helper method to describe objects in various formats.
#[derive(Default)]
@@ -113,11 +111,11 @@ impl DescriptorHelper {
}
impl HelperInterface for DescriptorHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
index e26915e3..056a2ffe 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/formatter_helper.rs
@@ -4,8 +4,6 @@ use crate::symfony::console::formatter::output_formatter::OutputFormatter;
use crate::symfony::console::helper::helper::Helper;
use crate::symfony::console::helper::helper_interface::HelperInterface;
use crate::symfony::console::helper::helper_set::HelperSet;
-use std::cell::RefCell;
-use std::rc::Rc;
/// The Formatter class provides helpers to format messages.
#[derive(Debug, Default)]
@@ -80,11 +78,11 @@ impl FormatterHelper {
}
impl HelperInterface for FormatterHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs
index 64256591..be5eb050 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper.rs
@@ -3,21 +3,22 @@
use crate::symfony::console::formatter::output_formatter_interface::OutputFormatterInterface;
use crate::symfony::console::helper::helper_set::HelperSet;
use crate::symfony::string::unicode_string::UnicodeString;
-use std::cell::RefCell;
-use std::rc::Rc;
/// Helper is the base class for all helper classes.
#[derive(Debug, Default)]
pub struct Helper {
- pub(crate) helper_set: Option<Rc<RefCell<HelperSet>>>,
+ pub(crate) helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>,
}
impl Helper {
- pub fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ pub fn set_helper_set(
+ &mut self,
+ helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>,
+ ) {
self.helper_set = helper_set;
}
- pub fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ pub fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.helper_set.clone()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs
index 4d767bfe..8dae6c85 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper_interface.rs
@@ -1,16 +1,14 @@
//! ref: composer/vendor/symfony/console/Helper/HelperInterface.php
use crate::symfony::console::helper::helper_set::HelperSet;
-use std::cell::RefCell;
-use std::rc::Rc;
/// HelperInterface is the interface all helpers must implement.
pub trait HelperInterface: std::fmt::Debug + shirabe_php_shim::AsAny {
/// Sets the helper set associated with this helper.
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>);
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>);
/// Gets the helper set associated with this helper.
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>>;
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>;
/// Returns the canonical name of this helper.
fn get_name(&self) -> String;
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs b/crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs
index d72b6277..b505fedf 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/helper_set.rs
@@ -5,8 +5,6 @@ use crate::symfony::console::helper::formatter_helper::FormatterHelper;
use crate::symfony::console::helper::helper_interface::HelperInterface;
use crate::symfony::console::helper::process_helper::ProcessHelper;
use crate::symfony::console::helper::question_helper::QuestionHelper;
-use std::cell::RefCell;
-use std::rc::Rc;
/// HelperSet represents a set of helpers to be used with a command.
///
@@ -20,22 +18,24 @@ use std::rc::Rc;
/// lookup) is deferred until the plugin API is implemented.
#[derive(Debug)]
pub struct HelperSet {
- formatter_helper: Rc<RefCell<FormatterHelper>>,
- debug_formatter_helper: Rc<RefCell<DebugFormatterHelper>>,
- process_helper: Rc<RefCell<ProcessHelper>>,
- question_helper: Rc<RefCell<QuestionHelper>>,
+ formatter_helper: std::rc::Rc<std::cell::RefCell<FormatterHelper>>,
+ debug_formatter_helper: std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>>,
+ process_helper: std::rc::Rc<std::cell::RefCell<ProcessHelper>>,
+ question_helper: std::rc::Rc<std::cell::RefCell<QuestionHelper>>,
}
impl HelperSet {
/// Builds the fixed set of helpers and wires each one's back-reference to the owning set,
/// mirroring the `$helper->setHelperSet($this)` call PHP's `HelperSet::set()` performs.
- pub fn new() -> Rc<RefCell<HelperSet>> {
- let formatter_helper = Rc::new(RefCell::new(FormatterHelper::default()));
- let debug_formatter_helper = Rc::new(RefCell::new(DebugFormatterHelper::default()));
- let process_helper = Rc::new(RefCell::new(ProcessHelper::default()));
- let question_helper = Rc::new(RefCell::new(QuestionHelper::default()));
+ pub fn new() -> std::rc::Rc<std::cell::RefCell<HelperSet>> {
+ let formatter_helper =
+ std::rc::Rc::new(std::cell::RefCell::new(FormatterHelper::default()));
+ let debug_formatter_helper =
+ std::rc::Rc::new(std::cell::RefCell::new(DebugFormatterHelper::default()));
+ let process_helper = std::rc::Rc::new(std::cell::RefCell::new(ProcessHelper::default()));
+ let question_helper = std::rc::Rc::new(std::cell::RefCell::new(QuestionHelper::default()));
- let this = Rc::new(RefCell::new(HelperSet {
+ let this = std::rc::Rc::new(std::cell::RefCell::new(HelperSet {
formatter_helper: formatter_helper.clone(),
debug_formatter_helper: debug_formatter_helper.clone(),
process_helper: process_helper.clone(),
@@ -58,19 +58,19 @@ impl HelperSet {
this
}
- pub fn get_formatter(&self) -> Rc<RefCell<FormatterHelper>> {
+ pub fn get_formatter(&self) -> std::rc::Rc<std::cell::RefCell<FormatterHelper>> {
self.formatter_helper.clone()
}
- pub fn get_debug_formatter(&self) -> Rc<RefCell<DebugFormatterHelper>> {
+ pub fn get_debug_formatter(&self) -> std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>> {
self.debug_formatter_helper.clone()
}
- pub fn get_process(&self) -> Rc<RefCell<ProcessHelper>> {
+ pub fn get_process(&self) -> std::rc::Rc<std::cell::RefCell<ProcessHelper>> {
self.process_helper.clone()
}
- pub fn get_question(&self) -> Rc<RefCell<QuestionHelper>> {
+ pub fn get_question(&self) -> std::rc::Rc<std::cell::RefCell<QuestionHelper>> {
self.question_helper.clone()
}
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs
index 28e2329a..58d1ea3f 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/process_helper.rs
@@ -8,8 +8,6 @@ use crate::symfony::console::output::ConsoleOutputInterface;
use crate::symfony::console::output::output_interface::{self, OutputInterface};
use crate::symfony::process::exception::process_failed_exception::ProcessFailedException;
use crate::symfony::process::process::Process;
-use std::cell::RefCell;
-use std::rc::Rc;
/// The ProcessHelper class provides helpers to run external processes.
///
@@ -41,7 +39,7 @@ impl ProcessHelper {
/// output available on STDOUT or STDERR
pub fn run(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
cmd: ProcessHelperCmd,
error: Option<&str>,
callback: Option<Box<dyn FnMut(&str, &str)>>,
@@ -54,14 +52,14 @@ impl ProcessHelper {
// $output->getErrorOutput(); }`. ConsoleOutput is the only OutputInterface
// implementor that also implements ConsoleOutputInterface, so the check
// reduces to a downcast to the concrete type.
- let output: Rc<RefCell<dyn OutputInterface>> = {
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = {
let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow())
.downcast_ref::<crate::symfony::console::output::console_output::ConsoleOutput>()
.map(|console| console.get_error_output());
redirected.unwrap_or(output)
};
- let formatter: Rc<RefCell<DebugFormatterHelper>> = self
+ let formatter: std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>> = self
.get_helper_set()
.unwrap()
.borrow()
@@ -200,7 +198,7 @@ impl ProcessHelper {
/// @see run()
pub fn must_run(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
cmd: ProcessHelperCmd,
error: Option<&str>,
callback: Option<Box<dyn FnMut(&str, &str)>>,
@@ -223,7 +221,7 @@ impl ProcessHelper {
/// Wraps a Process callback to add debugging output.
pub fn wrap_callback(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
process: &Process,
mut callback: Option<Box<dyn FnMut(&str, &str)>>,
) -> Box<dyn FnMut(&str, &str)> {
@@ -231,14 +229,14 @@ impl ProcessHelper {
// $output->getErrorOutput(); }`. ConsoleOutput is the only OutputInterface
// implementor that also implements ConsoleOutputInterface, so the check
// reduces to a downcast to the concrete type.
- let output: Rc<RefCell<dyn OutputInterface>> = {
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = {
let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow())
.downcast_ref::<crate::symfony::console::output::console_output::ConsoleOutput>()
.map(|console| console.get_error_output());
redirected.unwrap_or(output)
};
- let formatter: Rc<RefCell<DebugFormatterHelper>> = self
+ let formatter: std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>> = self
.get_helper_set()
.unwrap()
.borrow()
@@ -272,7 +270,7 @@ impl ProcessHelper {
}
fn formatter_start(
- formatter: &Rc<RefCell<DebugFormatterHelper>>,
+ formatter: &std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>>,
id: &str,
message: &str,
) -> String {
@@ -280,7 +278,7 @@ impl ProcessHelper {
}
fn formatter_stop(
- formatter: &Rc<RefCell<DebugFormatterHelper>>,
+ formatter: &std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>>,
id: &str,
message: &str,
successful: bool,
@@ -289,7 +287,7 @@ impl ProcessHelper {
}
fn formatter_progress(
- formatter: &Rc<RefCell<DebugFormatterHelper>>,
+ formatter: &std::rc::Rc<std::cell::RefCell<DebugFormatterHelper>>,
id: &str,
buffer: &str,
error: bool,
@@ -301,11 +299,11 @@ impl ProcessHelper {
}
impl HelperInterface for ProcessHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs b/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs
index a18e62f5..0abee1e7 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/progress_bar.rs
@@ -9,8 +9,6 @@ use crate::symfony::console::output::OutputInterface;
use crate::symfony::console::output::output_interface;
use crate::symfony::console::terminal::Terminal;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
pub const FORMAT_VERBOSE: &str = "verbose";
pub const FORMAT_VERY_VERBOSE: &str = "very_verbose";
@@ -26,7 +24,7 @@ const FORMAT_NORMAL_NOMAX: &str = "normal_nomax";
pub type PlaceholderFormatter = Box<
dyn Fn(
&ProgressBar,
- &Rc<RefCell<dyn OutputInterface>>,
+ &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<Result<shirabe_php_shim::PhpMixed, LogicException>>,
>;
@@ -44,7 +42,7 @@ pub struct ProgressBar {
last_write_time: f64,
min_seconds_between_redraws: f64,
max_seconds_between_redraws: f64,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
step: i64,
max: i64,
start_time: i64,
@@ -58,14 +56,14 @@ pub struct ProgressBar {
}
thread_local! {
- static FORMATTERS: RefCell<Option<IndexMap<String, PlaceholderFormatter>>> = const { RefCell::new(None) };
- static FORMATS: RefCell<Option<IndexMap<String, String>>> = const { RefCell::new(None) };
+ static FORMATTERS: std::cell::RefCell<Option<IndexMap<String, PlaceholderFormatter>>> = const { std::cell::RefCell::new(None) };
+ static FORMATS: std::cell::RefCell<Option<IndexMap<String, String>>> = const { std::cell::RefCell::new(None) };
}
impl ProgressBar {
/// `$max` Maximum steps (0 if unknown)
pub fn new(
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
max: i64,
min_seconds_between_redraws: f64,
) -> Self {
@@ -73,7 +71,7 @@ impl ProgressBar {
// $output->getErrorOutput(); }`. ConsoleOutput is the only OutputInterface
// implementor that also implements ConsoleOutputInterface, so the check
// reduces to a downcast to the concrete type.
- let output: Rc<RefCell<dyn OutputInterface>> = {
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = {
let redirected = shirabe_php_shim::AsAny::as_any(&*output.borrow())
.downcast_ref::<crate::symfony::console::output::console_output::ConsoleOutput>()
.map(|console| console.get_error_output());
@@ -596,7 +594,8 @@ impl ProgressBar {
formatters.insert(
"bar".to_string(),
Box::new(
- |bar: &ProgressBar, output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
let complete_bars = bar.get_bar_offset();
let mut display = shirabe_php_shim::str_repeat(
&bar.get_bar_character(),
@@ -627,7 +626,8 @@ impl ProgressBar {
formatters.insert(
"elapsed".to_string(),
Box::new(
- |bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::String(
Helper::format_time(
(shirabe_php_shim::time() - bar.get_start_time()) as f64,
@@ -640,7 +640,7 @@ impl ProgressBar {
formatters.insert(
"remaining".to_string(),
- Box::new(|bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ Box::new(|bar: &ProgressBar, _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
if bar.get_max_steps() == 0 {
return Ok(Err(LogicException(shirabe_php_shim::LogicException {
message: "Unable to display the remaining time if the maximum number of steps is not set.".to_string(),
@@ -656,7 +656,7 @@ impl ProgressBar {
formatters.insert(
"estimated".to_string(),
- Box::new(|bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ Box::new(|bar: &ProgressBar, _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
if bar.get_max_steps() == 0 {
return Ok(Err(LogicException(shirabe_php_shim::LogicException {
message: "Unable to display the estimated time if the maximum number of steps is not set.".to_string(),
@@ -673,7 +673,8 @@ impl ProgressBar {
formatters.insert(
"memory".to_string(),
Box::new(
- |_bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |_bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::String(
Helper::format_memory(shirabe_php_shim::memory_get_usage()),
)))
@@ -684,7 +685,8 @@ impl ProgressBar {
formatters.insert(
"current".to_string(),
Box::new(
- |bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::String(
shirabe_php_shim::str_pad(
&bar.get_progress().to_string(),
@@ -700,7 +702,8 @@ impl ProgressBar {
formatters.insert(
"max".to_string(),
Box::new(
- |bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::Int(bar.get_max_steps())))
},
),
@@ -709,7 +712,8 @@ impl ProgressBar {
formatters.insert(
"percent".to_string(),
Box::new(
- |bar: &ProgressBar, _output: &Rc<RefCell<dyn OutputInterface>>| {
+ |bar: &ProgressBar,
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>| {
Ok(Ok(shirabe_php_shim::PhpMixed::Float(
(bar.get_progress_percent() * 100.0).floor(),
)))
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs
index b6d096aa..3f95f4da 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/question_helper.rs
@@ -20,8 +20,6 @@ use crate::symfony::console::question::QuestionInterface;
use crate::symfony::console::terminal::Terminal;
use crate::symfony::string::s;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// The QuestionHelper class provides helpers to interact with the user.
#[derive(Debug, Default)]
@@ -46,7 +44,7 @@ impl QuestionHelper {
pub fn ask(
&mut self,
input: &mut dyn InputInterface,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) -> anyhow::Result<Result<PhpMixed, MissingInputException>> {
let mut output = output;
@@ -73,12 +71,12 @@ impl QuestionHelper {
let result: anyhow::Result<Result<PhpMixed, MissingInputException>> = (|| {
if question.get_validator().is_none() {
- return self.do_ask(Rc::clone(&output), question);
+ return self.do_ask(std::rc::Rc::clone(&output), question);
}
- let interviewer = || self.do_ask(Rc::clone(&output), question);
+ let interviewer = || self.do_ask(std::rc::Rc::clone(&output), question);
- self.validate_attempts(&interviewer, Rc::clone(&output), question)
+ self.validate_attempts(&interviewer, std::rc::Rc::clone(&output), question)
})();
let result = result?;
@@ -113,10 +111,10 @@ impl QuestionHelper {
/// @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
fn do_ask(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) -> anyhow::Result<Result<PhpMixed, MissingInputException>> {
- self.write_prompt(Rc::clone(&output), question);
+ self.write_prompt(std::rc::Rc::clone(&output), question);
let input_stream = self
.input_stream
@@ -134,8 +132,12 @@ impl QuestionHelper {
// The autocompleter callback yields an iterable (Option here); PHP
// treats a null result as an empty list of suggestions.
let callback = move |input: &str| callback(input).unwrap_or_default();
- let autocomplete =
- self.autocomplete(Rc::clone(&output), question, &input_stream, &callback);
+ let autocomplete = self.autocomplete(
+ std::rc::Rc::clone(&output),
+ question,
+ &input_stream,
+ &callback,
+ );
ret = PhpMixed::String(if question.is_trimmable() {
shirabe_php_shim::trim(&autocomplete, None)
} else {
@@ -145,7 +147,7 @@ impl QuestionHelper {
let mut r: PhpMixed = PhpMixed::Bool(false);
if question.is_hidden() {
match self.get_hidden_response(
- Rc::clone(&output),
+ std::rc::Rc::clone(&output),
&input_stream,
question.is_trimmable(),
)? {
@@ -261,7 +263,7 @@ impl QuestionHelper {
/// Outputs the question prompt.
pub(crate) fn write_prompt(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) {
let mut message = question.get_question().to_string();
@@ -313,7 +315,7 @@ impl QuestionHelper {
/// Outputs an error message.
pub(crate) fn write_error(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
error: &shirabe_php_shim::Exception,
) {
let message = if let Some(helper_set) = self.get_helper_set() {
@@ -338,12 +340,12 @@ impl QuestionHelper {
/// @param resource $inputStream
fn autocomplete(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
input_stream: &shirabe_php_shim::PhpResource,
autocomplete: &dyn Fn(&str) -> Vec<PhpMixed>,
) -> String {
- let cursor = Cursor::new(Rc::clone(&output), Some(input_stream.clone()));
+ let cursor = Cursor::new(std::rc::Rc::clone(&output), Some(input_stream.clone()));
let mut full_choice = String::new();
let mut ret = String::new();
@@ -594,7 +596,7 @@ impl QuestionHelper {
/// @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden
fn get_hidden_response(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
input_stream: &shirabe_php_shim::PhpResource,
trimmable: bool,
) -> anyhow::Result<Result<String, RuntimeException>> {
@@ -679,7 +681,7 @@ impl QuestionHelper {
fn validate_attempts(
&self,
interviewer: &dyn Fn() -> anyhow::Result<Result<PhpMixed, MissingInputException>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) -> anyhow::Result<Result<PhpMixed, MissingInputException>> {
let mut error: Option<shirabe_php_shim::Exception> = None;
@@ -694,7 +696,7 @@ impl QuestionHelper {
}
if let Some(ref error) = error {
- self.write_error(Rc::clone(&output), error);
+ self.write_error(std::rc::Rc::clone(&output), error);
}
let interviewed = match interviewer()? {
@@ -876,11 +878,11 @@ fn magic_file() -> String {
}
impl HelperInterface for QuestionHelper {
- fn set_helper_set(&mut self, helper_set: Option<Rc<RefCell<HelperSet>>>) {
+ fn set_helper_set(&mut self, helper_set: Option<std::rc::Rc<std::cell::RefCell<HelperSet>>>) {
self.inner.set_helper_set(helper_set);
}
- fn get_helper_set(&self) -> Option<Rc<RefCell<HelperSet>>> {
+ fn get_helper_set(&self) -> Option<std::rc::Rc<std::cell::RefCell<HelperSet>>> {
self.inner.get_helper_set()
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs b/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs
index a5118f4e..786141e9 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/symfony_question_helper.rs
@@ -7,9 +7,7 @@ use crate::symfony::console::output::output_interface::OutputInterface;
use crate::symfony::console::question::QuestionInterface;
use crate::symfony::console::style::symfony_style::SymfonyStyle;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
-use std::rc::Rc;
/// Symfony Style Guide compliant question helper.
#[derive(Debug, Default)]
@@ -24,7 +22,7 @@ impl SymfonyQuestionHelper {
pub(crate) fn write_prompt(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question: &impl QuestionInterface,
) {
let mut text = OutputFormatter::escape_trailing_backslash(question.get_question());
@@ -112,7 +110,7 @@ impl SymfonyQuestionHelper {
pub(crate) fn write_error(
&self,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
error: &shirabe_php_shim::Exception,
) {
let is_symfony_style = {
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs
index 04d5f1f6..cae3f896 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/table.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/table.rs
@@ -15,8 +15,6 @@ use crate::symfony::console::output::console_section_output::ConsoleSectionOutpu
use crate::symfony::console::output::output_interface::OutputInterface;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// A single cell within a table row.
///
@@ -58,7 +56,7 @@ impl Cell {
}
}
- fn style(&self) -> Option<Rc<TableCellStyle>> {
+ fn style(&self) -> Option<std::rc::Rc<TableCellStyle>> {
match self {
Cell::Cell(c) => c.get_style(),
Cell::Separator(s) => s.get_style(),
@@ -246,7 +244,7 @@ pub struct Table {
/// Number of columns cache.
number_of_columns: Option<i64>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
style: TableStyle,
@@ -276,7 +274,7 @@ fn styles() -> &'static std::sync::Mutex<Option<IndexMap<String, TableStyle>>> {
}
impl Table {
- pub fn new(output: Rc<RefCell<dyn OutputInterface>>) -> Self {
+ pub fn new(output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) -> Self {
let mut styles_guard = styles().lock().unwrap();
if styles_guard.is_none() {
*styles_guard = Some(Self::init_styles());
@@ -1383,7 +1381,9 @@ impl Table {
)))
}
- fn formatter_is_wrappable(_output: &Rc<RefCell<dyn OutputInterface>>) -> bool {
+ fn formatter_is_wrappable(
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> bool {
// PHP: $this->output->getFormatter() instanceof WrappableOutputFormatterInterface
// TODO(phase-c/d): instanceof on `dyn OutputFormatterInterface` needs an AsAny supertrait
// on OutputFormatterInterface to downcast to the concrete wrappable formatter; adding it
@@ -1399,7 +1399,9 @@ impl Table {
Helper::remove_decoration(&mut *formatter, string)
}
- fn output_is_console_section(output: &Rc<RefCell<dyn OutputInterface>>) -> bool {
+ fn output_is_console_section(
+ output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> bool {
// PHP: $this->output instanceof ConsoleSectionOutput
let borrowed = output.borrow();
(*borrowed)
@@ -1417,7 +1419,7 @@ impl Table {
fn table_cell_options_colspan_style(
colspan: i64,
- style: Option<Rc<TableCellStyle>>,
+ style: Option<std::rc::Rc<TableCellStyle>>,
) -> IndexMap<String, TableCellOption> {
// PHP: ['colspan' => $colspan, 'style' => $style]
let mut options = IndexMap::new();
diff --git a/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs b/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs
index b85b7d1d..2b1e592b 100644
--- a/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/helper/table_cell.rs
@@ -3,13 +3,12 @@
use crate::symfony::console::exception::invalid_argument_exception::InvalidArgumentException;
use crate::symfony::console::helper::table_cell_style::TableCellStyle;
use indexmap::IndexMap;
-use std::rc::Rc;
/// A `TableCell` option value: an integer span, a `TableCellStyle`, or null.
#[derive(Debug, Clone)]
pub enum TableCellOption {
Int(i64),
- Style(Rc<TableCellStyle>),
+ Style(std::rc::Rc<TableCellStyle>),
Null,
}
@@ -94,7 +93,7 @@ impl TableCell {
}
}
- pub fn get_style(&self) -> Option<Rc<TableCellStyle>> {
+ pub fn get_style(&self) -> Option<std::rc::Rc<TableCellStyle>> {
match &self.options["style"] {
TableCellOption::Style(style) => Some(style.clone()),
_ => None,
diff --git a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
index 279811fb..2c06b05f 100644
--- a/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/input/input_definition.rs
@@ -6,7 +6,6 @@ use crate::symfony::console::input::input_argument::InputArgument;
use crate::symfony::console::input::input_option::InputOption;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::rc::Rc;
/// A InputDefinition represents a set of valid command line arguments and options.
///
@@ -15,11 +14,11 @@ use std::rc::Rc;
/// (PHP `bind` assigns the definition by reference).
#[derive(Debug, Clone)]
pub struct InputDefinition {
- arguments: IndexMap<String, Rc<InputArgument>>,
+ arguments: IndexMap<String, std::rc::Rc<InputArgument>>,
required_count: i64,
- last_array_argument: Option<Rc<InputArgument>>,
- last_optional_argument: Option<Rc<InputArgument>>,
- options: IndexMap<String, Rc<InputOption>>,
+ last_array_argument: Option<std::rc::Rc<InputArgument>>,
+ last_optional_argument: Option<std::rc::Rc<InputArgument>>,
+ options: IndexMap<String, std::rc::Rc<InputOption>>,
negations: IndexMap<String, String>,
shortcuts: IndexMap<String, String>,
}
@@ -50,7 +49,7 @@ impl InputDefinition {
/// reference, mirroring `new InputDefinition($definition->getOptions())`.
/// `InputOption` is not `Clone` and lives behind `Rc`, so the options are
/// reused rather than reconstructed by value.
- pub fn from_options(options: Vec<Rc<InputOption>>) -> anyhow::Result<Self> {
+ pub fn from_options(options: Vec<std::rc::Rc<InputOption>>) -> anyhow::Result<Self> {
let mut input_definition = InputDefinition {
arguments: IndexMap::new(),
required_count: 0,
@@ -108,7 +107,7 @@ impl InputDefinition {
}
pub fn add_argument(&mut self, argument: InputArgument) -> anyhow::Result<()> {
- let argument = Rc::new(argument);
+ let argument = std::rc::Rc::new(argument);
if self.arguments.contains_key(argument.get_name()) {
return Err(LogicException(shirabe_php_shim::LogicException {
@@ -148,13 +147,13 @@ impl InputDefinition {
}
if argument.is_array() {
- self.last_array_argument = Some(Rc::clone(&argument));
+ self.last_array_argument = Some(std::rc::Rc::clone(&argument));
}
if argument.is_required() {
self.required_count += 1;
} else {
- self.last_optional_argument = Some(Rc::clone(&argument));
+ self.last_optional_argument = Some(std::rc::Rc::clone(&argument));
}
self.arguments
@@ -164,7 +163,7 @@ impl InputDefinition {
}
/// Returns an InputArgument by name or by position.
- pub fn get_argument(&self, name: &PhpMixed) -> anyhow::Result<Rc<InputArgument>> {
+ pub fn get_argument(&self, name: &PhpMixed) -> anyhow::Result<std::rc::Rc<InputArgument>> {
if !self.has_argument(name) {
return Err(
InvalidArgumentException(shirabe_php_shim::InvalidArgumentException {
@@ -177,12 +176,13 @@ impl InputDefinition {
match name {
PhpMixed::Int(index) => {
- let arguments: Vec<Rc<InputArgument>> = self.arguments.values().cloned().collect();
- Ok(Rc::clone(&arguments[*index as usize]))
+ let arguments: Vec<std::rc::Rc<InputArgument>> =
+ self.arguments.values().cloned().collect();
+ Ok(std::rc::Rc::clone(&arguments[*index as usize]))
}
_ => {
let key = shirabe_php_shim::php_to_string(name);
- Ok(Rc::clone(&self.arguments[&key]))
+ Ok(std::rc::Rc::clone(&self.arguments[&key]))
}
}
}
@@ -191,7 +191,8 @@ impl InputDefinition {
pub fn has_argument(&self, name: &PhpMixed) -> bool {
match name {
PhpMixed::Int(index) => {
- let arguments: Vec<Rc<InputArgument>> = self.arguments.values().cloned().collect();
+ let arguments: Vec<std::rc::Rc<InputArgument>> =
+ self.arguments.values().cloned().collect();
*index >= 0 && (*index as usize) < arguments.len()
}
_ => {
@@ -202,7 +203,7 @@ impl InputDefinition {
}
/// Gets the array of InputArgument objects.
- pub fn get_arguments(&self) -> &IndexMap<String, Rc<InputArgument>> {
+ pub fn get_arguments(&self) -> &IndexMap<String, std::rc::Rc<InputArgument>> {
&self.arguments
}
@@ -250,12 +251,12 @@ impl InputDefinition {
}
pub fn add_option(&mut self, option: InputOption) -> anyhow::Result<()> {
- self.add_option_rc(Rc::new(option))
+ self.add_option_rc(std::rc::Rc::new(option))
}
/// Adds an option that is already shared behind `Rc`, mirroring PHP passing
/// `InputOption` objects by reference.
- pub fn add_option_rc(&mut self, option: Rc<InputOption>) -> anyhow::Result<()> {
+ pub fn add_option_rc(&mut self, option: std::rc::Rc<InputOption>) -> anyhow::Result<()> {
if let Some(existing) = self.options.get(option.get_name())
&& !option.equals(existing)
{
@@ -291,7 +292,7 @@ impl InputDefinition {
}
self.options
- .insert(option.get_name().to_string(), Rc::clone(&option));
+ .insert(option.get_name().to_string(), std::rc::Rc::clone(&option));
if let Some(shortcut) = option.get_shortcut() {
for shortcut in shirabe_php_shim::explode("|", shortcut) {
self.shortcuts
@@ -319,7 +320,7 @@ impl InputDefinition {
}
/// Returns an InputOption by name.
- pub fn get_option(&self, name: &str) -> anyhow::Result<Rc<InputOption>> {
+ pub fn get_option(&self, name: &str) -> anyhow::Result<std::rc::Rc<InputOption>> {
if !self.has_option(name) {
return Err(
InvalidArgumentException(shirabe_php_shim::InvalidArgumentException {
@@ -330,7 +331,7 @@ impl InputDefinition {
);
}
- Ok(Rc::clone(&self.options[name]))
+ Ok(std::rc::Rc::clone(&self.options[name]))
}
/// Returns true if an InputOption object exists by name.
@@ -342,7 +343,7 @@ impl InputDefinition {
}
/// Gets the array of InputOption objects.
- pub fn get_options(&self) -> &IndexMap<String, Rc<InputOption>> {
+ pub fn get_options(&self) -> &IndexMap<String, std::rc::Rc<InputOption>> {
&self.options
}
@@ -357,7 +358,10 @@ impl InputDefinition {
}
/// Gets an InputOption by shortcut.
- pub fn get_option_for_shortcut(&self, shortcut: &str) -> anyhow::Result<Rc<InputOption>> {
+ pub fn get_option_for_shortcut(
+ &self,
+ shortcut: &str,
+ ) -> anyhow::Result<std::rc::Rc<InputOption>> {
self.get_option(&self.shortcut_to_name(shortcut)?)
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs
index 9a162746..12fd3dcb 100644
--- a/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/style/output_style.rs
@@ -7,17 +7,15 @@ use crate::symfony::console::output::OutputInterface;
use crate::symfony::console::output::output_interface::OUTPUT_NORMAL;
use crate::symfony::console::style::style_interface::StyleInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// Decorates output to add console style guide helpers.
#[derive(Debug)]
pub struct OutputStyle {
- output: Rc<RefCell<dyn OutputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
}
impl OutputStyle {
- pub fn new(output: Rc<RefCell<dyn OutputInterface>>) -> Self {
+ pub fn new(output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>) -> Self {
Self { output }
}
@@ -25,7 +23,7 @@ impl OutputStyle {
ProgressBar::new(self.output.clone(), max, 1.0 / 25.0)
}
- pub(crate) fn get_error_output(&self) -> Rc<RefCell<dyn OutputInterface>> {
+ pub(crate) fn get_error_output(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> {
// PHP checks `$this->output instanceof ConsoleOutputInterface`; this requires
// runtime type information that the OutputInterface trait object lacks.
if !Self::is_console_output_interface(&self.output) {
@@ -38,7 +36,9 @@ impl OutputStyle {
.get_error_output()
}
- fn is_console_output_interface(output: &Rc<RefCell<dyn OutputInterface>>) -> bool {
+ fn is_console_output_interface(
+ output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> bool {
// ConsoleOutput is the only OutputInterface implementor that also implements
// ConsoleOutputInterface, so `instanceof ConsoleOutputInterface` reduces to this downcast.
shirabe_php_shim::AsAny::as_any(&*output.borrow())
@@ -47,8 +47,8 @@ impl OutputStyle {
}
fn as_console_output_interface(
- _output: &Rc<RefCell<dyn OutputInterface>>,
- ) -> Option<Rc<RefCell<dyn ConsoleOutputInterface>>> {
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> Option<std::rc::Rc<std::cell::RefCell<dyn ConsoleOutputInterface>>> {
todo!()
}
}
@@ -94,11 +94,14 @@ impl OutputInterface for OutputStyle {
self.output.borrow().is_decorated()
}
- fn set_formatter(&self, formatter: Rc<RefCell<dyn OutputFormatterInterface>>) {
+ fn set_formatter(
+ &self,
+ formatter: std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>>,
+ ) {
self.output.borrow().set_formatter(formatter);
}
- fn get_formatter(&self) -> Rc<RefCell<dyn OutputFormatterInterface>> {
+ fn get_formatter(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>> {
self.output.borrow().get_formatter()
}
}
diff --git a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs
index 425c815b..69cd4191 100644
--- a/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs
+++ b/crates/shirabe-external-packages/src/symfony/console/style/symfony_style.rs
@@ -24,15 +24,13 @@ use crate::symfony::console::style::output_style::OutputStyle;
use crate::symfony::console::style::style_interface::StyleInterface;
use crate::symfony::console::terminal::Terminal;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// Output decorator helpers for the Symfony Style Guide.
#[derive(Debug)]
pub struct SymfonyStyle {
inner: OutputStyle,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
question_helper: Option<SymfonyQuestionHelper>,
progress_bar: Option<ProgressBar>,
line_length: i64,
@@ -43,8 +41,8 @@ pub const MAX_LINE_LENGTH: i64 = 120;
impl SymfonyStyle {
pub fn new(
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> Self {
let buffered_output = TrimmedBufferOutput::new(
if std::path::MAIN_SEPARATOR == '\\' {
@@ -260,7 +258,7 @@ impl SymfonyStyle {
Self::as_console_output_interface(&self.output)
.unwrap()
.borrow()
- .section() as Rc<RefCell<dyn OutputInterface>>
+ .section() as std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>
} else {
self.output.clone()
};
@@ -435,11 +433,13 @@ impl SymfonyStyle {
lines
}
- fn get_formatter(&self) -> Rc<RefCell<dyn OutputFormatterInterface>> {
+ fn get_formatter(&self) -> std::rc::Rc<std::cell::RefCell<dyn OutputFormatterInterface>> {
self.output.borrow().get_formatter()
}
- fn is_console_output_interface(output: &Rc<RefCell<dyn OutputInterface>>) -> bool {
+ fn is_console_output_interface(
+ output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> bool {
// ConsoleOutput is the only OutputInterface implementor that also implements
// ConsoleOutputInterface, so `instanceof ConsoleOutputInterface` reduces to this downcast.
shirabe_php_shim::AsAny::as_any(&*output.borrow())
@@ -448,8 +448,8 @@ impl SymfonyStyle {
}
fn as_console_output_interface(
- _output: &Rc<RefCell<dyn OutputInterface>>,
- ) -> Option<Rc<RefCell<dyn ConsoleOutputInterface>>> {
+ _output: &std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> Option<std::rc::Rc<std::cell::RefCell<dyn ConsoleOutputInterface>>> {
todo!()
}
diff --git a/crates/shirabe-external-packages/src/symfony/finder/finder.rs b/crates/shirabe-external-packages/src/symfony/finder/finder.rs
index 2a7e5442..7d3bdc10 100644
--- a/crates/shirabe-external-packages/src/symfony/finder/finder.rs
+++ b/crates/shirabe-external-packages/src/symfony/finder/finder.rs
@@ -11,7 +11,6 @@ use crate::symfony::finder::glob::Glob;
use chrono::{NaiveDate, NaiveDateTime};
use indexmap::{IndexMap, IndexSet};
use shirabe_php_shim::{file_exists, glob, is_dir, preg_quote, rtrim};
-use std::cell::RefCell;
use std::path::{Path, PathBuf};
use std::time::UNIX_EPOCH;
@@ -75,7 +74,7 @@ enum Sort {
None,
ByName,
ByAccessedTime,
- Closure(RefCell<Box<dyn FnMut(&PathBuf, &PathBuf) -> i64>>),
+ Closure(std::cell::RefCell<Box<dyn FnMut(&PathBuf, &PathBuf) -> i64>>),
}
/// One traversal result, replacing `Symfony\Component\Finder\SplFileInfo`.
@@ -97,7 +96,7 @@ pub struct Finder {
names: Vec<String>,
not_names: Vec<String>,
exclude: Vec<String>,
- filters: Vec<RefCell<Box<dyn FnMut(&Path) -> bool>>>,
+ filters: Vec<std::cell::RefCell<Box<dyn FnMut(&Path) -> bool>>>,
depths: Vec<(String, i64)>,
follow_links: bool,
reverse_sorting: bool,
@@ -204,7 +203,7 @@ impl Finder {
}
pub fn filter(&mut self, closure: Box<dyn FnMut(&std::path::Path) -> bool>) -> &mut Self {
- self.filters.push(RefCell::new(closure));
+ self.filters.push(std::cell::RefCell::new(closure));
self
}
@@ -263,7 +262,7 @@ impl Finder {
where
F: FnMut(&PathBuf, &PathBuf) -> i64 + 'static,
{
- self.sort = Sort::Closure(RefCell::new(Box::new(comparator)));
+ self.sort = Sort::Closure(std::cell::RefCell::new(Box::new(comparator)));
self
}
diff --git a/crates/shirabe-php-shim/src/xml.rs b/crates/shirabe-php-shim/src/xml.rs
index b3938da1..8e988a87 100644
--- a/crates/shirabe-php-shim/src/xml.rs
+++ b/crates/shirabe-php-shim/src/xml.rs
@@ -4,8 +4,7 @@
//! is held behind `Rc<RefCell<_>>`. `DOMDocument`, `DOMNode` and `DOMNodeList` are thin
//! handles over that graph.
-use std::cell::RefCell;
-use std::rc::{Rc, Weak};
+use std::rc::Weak;
#[derive(Debug, Clone, Copy, PartialEq)]
enum NodeType {
@@ -23,8 +22,8 @@ struct NodeInner {
attributes: Vec<(String, String)>,
/// Character data for text nodes.
value: String,
- children: Vec<Rc<RefCell<NodeInner>>>,
- owner_document: Weak<RefCell<NodeInner>>,
+ children: Vec<std::rc::Rc<std::cell::RefCell<NodeInner>>>,
+ owner_document: Weak<std::cell::RefCell<NodeInner>>,
/// Document-only fields.
version: String,
encoding: String,
@@ -33,11 +32,11 @@ struct NodeInner {
/// A document handle. PHP \DOMDocument.
#[derive(Debug, Clone)]
-pub struct DOMDocument(Rc<RefCell<NodeInner>>);
+pub struct DOMDocument(std::rc::Rc<std::cell::RefCell<NodeInner>>);
/// A node handle (element or text). PHP \DOMNode or \DOMElement.
#[derive(Debug, Clone)]
-pub struct DOMNode(Rc<RefCell<NodeInner>>);
+pub struct DOMNode(std::rc::Rc<std::cell::RefCell<NodeInner>>);
/// An ordered, live-ish snapshot of nodes. PHP \DOMNodeList.
#[derive(Debug, Clone)]
@@ -45,7 +44,7 @@ pub struct DOMNodeList(Vec<DOMNode>);
impl DOMDocument {
pub fn new(version: &str, encoding: &str) -> DOMDocument {
- DOMDocument(Rc::new(RefCell::new(NodeInner {
+ DOMDocument(std::rc::Rc::new(std::cell::RefCell::new(NodeInner {
node_type: NodeType::Document,
name: String::new(),
attributes: Vec::new(),
@@ -64,13 +63,13 @@ impl DOMDocument {
}
pub fn create_element(&self, name: &str) -> DOMNode {
- DOMNode(Rc::new(RefCell::new(NodeInner {
+ DOMNode(std::rc::Rc::new(std::cell::RefCell::new(NodeInner {
node_type: NodeType::Element,
name: name.to_string(),
attributes: Vec::new(),
value: String::new(),
children: Vec::new(),
- owner_document: Rc::downgrade(&self.0),
+ owner_document: std::rc::Rc::downgrade(&self.0),
version: String::new(),
encoding: String::new(),
format_output: false,
@@ -85,13 +84,13 @@ impl DOMDocument {
}
pub fn create_text_node(&self, data: &str) -> DOMNode {
- DOMNode(Rc::new(RefCell::new(NodeInner {
+ DOMNode(std::rc::Rc::new(std::cell::RefCell::new(NodeInner {
node_type: NodeType::Text,
name: String::new(),
attributes: Vec::new(),
value: data.to_string(),
children: Vec::new(),
- owner_document: Rc::downgrade(&self.0),
+ owner_document: std::rc::Rc::downgrade(&self.0),
version: String::new(),
encoding: String::new(),
format_output: false,
@@ -105,7 +104,7 @@ impl DOMDocument {
/// Deep- or shallow-copy a node so it can be inserted into this document.
pub fn import_node(&self, node: &DOMNode, deep: bool) -> DOMNode {
- DOMNode(deep_clone(&node.0, &Rc::downgrade(&self.0), deep))
+ DOMNode(deep_clone(&node.0, &std::rc::Rc::downgrade(&self.0), deep))
}
pub fn get_elements_by_tag_name(&self, name: &str) -> DOMNodeList {
@@ -205,10 +204,10 @@ impl IntoIterator for DOMNodeList {
}
fn deep_clone(
- node: &Rc<RefCell<NodeInner>>,
- owner: &Weak<RefCell<NodeInner>>,
+ node: &std::rc::Rc<std::cell::RefCell<NodeInner>>,
+ owner: &Weak<std::cell::RefCell<NodeInner>>,
deep: bool,
-) -> Rc<RefCell<NodeInner>> {
+) -> std::rc::Rc<std::cell::RefCell<NodeInner>> {
let source = node.borrow();
let children = if deep {
source
@@ -219,7 +218,7 @@ fn deep_clone(
} else {
Vec::new()
};
- Rc::new(RefCell::new(NodeInner {
+ std::rc::Rc::new(std::cell::RefCell::new(NodeInner {
node_type: source.node_type,
name: source.name.clone(),
attributes: source.attributes.clone(),
@@ -233,9 +232,9 @@ fn deep_clone(
}
fn collect_by_tag(
- node: &Rc<RefCell<NodeInner>>,
+ node: &std::rc::Rc<std::cell::RefCell<NodeInner>>,
name: &str,
- out: &mut Vec<Rc<RefCell<NodeInner>>>,
+ out: &mut Vec<std::rc::Rc<std::cell::RefCell<NodeInner>>>,
) {
for child in &node.borrow().children {
let is_match = {
@@ -250,7 +249,7 @@ fn collect_by_tag(
}
fn serialize_node<W: std::io::Write>(
- node: &Rc<RefCell<NodeInner>>,
+ node: &std::rc::Rc<std::cell::RefCell<NodeInner>>,
depth: usize,
format: bool,
out: &mut W,
diff --git a/crates/shirabe-php-shim/src/zip.rs b/crates/shirabe-php-shim/src/zip.rs
index 8bb51d1d..93b65fd5 100644
--- a/crates/shirabe-php-shim/src/zip.rs
+++ b/crates/shirabe-php-shim/src/zip.rs
@@ -2,7 +2,6 @@ use crate::ErrorException;
use crate::PhpMixed;
use crate::{StreamBacking, StreamState};
use indexmap::IndexMap;
-use std::cell::RefCell;
use zip::write::SimpleFileOptions;
/// Test-only behaviour mirroring PHPUnit's `getMockBuilder('ZipArchive')->getMock()`, where
@@ -36,7 +35,7 @@ enum ZipState {
#[derive(Debug)]
pub struct ZipArchive {
pub num_files: i64,
- state: RefCell<ZipState>,
+ state: std::cell::RefCell<ZipState>,
/// Test-only mock state. `None` in production; set via [`ZipArchive::__mock`] in tests.
mock: Option<ZipArchiveMock>,
}
@@ -51,7 +50,7 @@ impl ZipArchive {
pub fn new() -> Self {
Self {
num_files: 0,
- state: RefCell::new(ZipState::Closed),
+ state: std::cell::RefCell::new(ZipState::Closed),
mock: None,
}
}
@@ -61,7 +60,7 @@ impl ZipArchive {
pub fn __mock(mock: ZipArchiveMock) -> Self {
Self {
num_files: mock.count,
- state: RefCell::new(ZipState::Closed),
+ state: std::cell::RefCell::new(ZipState::Closed),
mock: Some(mock),
}
}
diff --git a/crates/shirabe/src/advisory/auditor.rs b/crates/shirabe/src/advisory/auditor.rs
index 402483c7..32e34380 100644
--- a/crates/shirabe/src/advisory/auditor.rs
+++ b/crates/shirabe/src/advisory/auditor.rs
@@ -18,8 +18,6 @@ use shirabe_php_shim::{
DATE_ATOM, InvalidArgumentException, PhpMixed, array_all, array_any, array_key_exists,
array_keys, array_reduce, get_class, sprintf, str_starts_with,
};
-use std::cell::RefCell;
-use std::rc::Rc;
/// Shape of the `--format=json` audit output.
#[derive(serde::Serialize)]
@@ -115,7 +113,7 @@ impl Auditor {
#[allow(clippy::too_many_arguments, reason = "to keep PHP signature")]
pub fn audit(
&self,
- io: &Rc<RefCell<dyn IOInterface>>,
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
repo_set: &RepositorySet,
packages: Vec<PackageInterfaceHandle>,
format: &str,
@@ -428,7 +426,7 @@ impl Auditor {
/// @param self::FORMAT_* $format The format that will be used to output audit results.
fn output_advisories(
&self,
- io: &Rc<RefCell<dyn IOInterface>>,
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
advisories: &IndexMap<String, Vec<AnySecurityAdvisory>>,
format: &str,
) -> anyhow::Result<()> {
@@ -528,7 +526,7 @@ impl Auditor {
/// @param array<string, array<SecurityAdvisory>> $advisories
fn output_advisories_plain(
&self,
- io: &Rc<RefCell<dyn IOInterface>>,
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
advisories: &IndexMap<String, Vec<AnySecurityAdvisory>>,
) -> anyhow::Result<()> {
let mut error: Vec<String> = vec![];
@@ -575,7 +573,7 @@ impl Auditor {
/// @param self::FORMAT_PLAIN|self::FORMAT_TABLE $format
fn output_abandoned_packages(
&self,
- io: &Rc<RefCell<dyn IOInterface>>,
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
packages: &[CompletePackageInterfaceHandle],
format: &str,
) -> anyhow::Result<()> {
diff --git a/crates/shirabe/src/command/about_command.rs b/crates/shirabe/src/command/about_command.rs
index 7983a580..386beebb 100644
--- a/crates/shirabe/src/command/about_command.rs
+++ b/crates/shirabe/src/command/about_command.rs
@@ -7,8 +7,6 @@ use crate::composer;
use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct AboutCommand {
@@ -43,8 +41,8 @@ impl Command for AboutCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer_version = composer::get_version();
let _ = (input, output);
@@ -60,8 +58,8 @@ impl Command for AboutCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/archive_command.rs b/crates/shirabe/src/command/archive_command.rs
index 741847a7..2a099c89 100644
--- a/crates/shirabe/src/command/archive_command.rs
+++ b/crates/shirabe/src/command/archive_command.rs
@@ -28,14 +28,12 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{LogicException, get_debug_type};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct ArchiveCommand {
base_command_data: BaseCommandData,
/// For testing only: partial-mock seam mirroring PHPUnit `onlyMethods(['initialize', 'archive'])`.
- test_hooks: RefCell<ArchiveCommandTestHooks>,
+ test_hooks: std::cell::RefCell<ArchiveCommandTestHooks>,
}
/// For testing only: records and stubs for the `ArchiveCommand` partial-mock seam.
@@ -70,7 +68,7 @@ impl ArchiveCommand {
pub fn new() -> Self {
let command = ArchiveCommand {
base_command_data: BaseCommandData::new(None),
- test_hooks: RefCell::new(ArchiveCommandTestHooks::default()),
+ test_hooks: std::cell::RefCell::new(ArchiveCommandTestHooks::default()),
};
command
.configure()
@@ -104,8 +102,8 @@ impl Command for ArchiveCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.try_composer(None, None);
@@ -206,8 +204,8 @@ impl Command for ArchiveCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
if self.test_hooks.borrow().skip_initialize {
return Ok(());
diff --git a/crates/shirabe/src/command/audit_command.rs b/crates/shirabe/src/command/audit_command.rs
index 236ecdc0..fb56169e 100644
--- a/crates/shirabe/src/command/audit_command.rs
+++ b/crates/shirabe/src/command/audit_command.rs
@@ -19,8 +19,6 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, UnexpectedValueException, implode, in_array,
};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct AuditCommand {
@@ -116,8 +114,8 @@ impl Command for AuditCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.require_composer(None, None)?;
let packages = self.get_packages(&composer, input.clone())?;
@@ -220,8 +218,8 @@ impl Command for AuditCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
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<Option<PartialComposerHandle>>,
- pub(crate) io: RefCell<Option<Rc<RefCell<dyn IOInterface>>>>,
+ pub(crate) composer: std::cell::RefCell<Option<PartialComposerHandle>>,
+ pub(crate) io: std::cell::RefCell<Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>>,
}
impl BaseCommandData {
pub fn new(name: Option<String>) -> 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<RefCell<dyn IOInterface>>;
+ fn get_io(&self) -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>>;
- fn set_io(&self, io: Rc<RefCell<dyn IOInterface>>);
+ fn set_io(&self, io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>);
/// 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<RefCell<dyn InputInterface>>,
- io: Rc<RefCell<dyn IOInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
config: Option<IndexMap<String, PhpMixed>>,
disable_plugins: bool,
disable_scripts: Option<bool>,
@@ -170,14 +168,14 @@ pub trait BaseCommand: Command {
fn get_preferred_install_options(
&self,
config: &Config,
- input: Rc<RefCell<dyn InputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
keep_vcs_requires_prefer_source: bool,
) -> anyhow::Result<(bool, bool)>;
fn get_platform_requirement_filter(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- ) -> anyhow::Result<Rc<dyn PlatformRequirementFilterInterface>>;
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ ) -> anyhow::Result<std::rc::Rc<dyn PlatformRequirementFilterInterface>>;
/// @param array<string> $requirements
///
@@ -196,7 +194,11 @@ pub trait BaseCommand: Command {
) -> anyhow::Result<Vec<IndexMap<String, String>>>;
/// @param array<TableSeparator|mixed[]> $table
- fn render_table(&self, table: Vec<PhpMixed>, output: Rc<RefCell<dyn OutputInterface>>);
+ fn render_table(
+ &self,
+ table: Vec<PhpMixed>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ );
fn get_terminal_width(&self) -> i64;
@@ -205,7 +207,7 @@ pub trait BaseCommand: Command {
/// @return Auditor::FORMAT_*
fn get_audit_format(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
opt_name: &str,
) -> anyhow::Result<String>;
@@ -213,7 +215,7 @@ pub trait BaseCommand: Command {
fn create_audit_config(
&self,
config: &mut Config,
- input: Rc<RefCell<dyn InputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
) -> anyhow::Result<AuditConfig>;
}
@@ -327,7 +329,7 @@ impl BaseCommand for BaseCommandData {
Ok(())
}
- fn get_io(&self) -> Rc<RefCell<dyn IOInterface>> {
+ fn get_io(&self) -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
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<RefCell<dyn IOInterface>>) {
+ fn set_io(&self, io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>) {
*self.io.borrow_mut() = Some(io);
}
fn create_composer_instance(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- io: Rc<RefCell<dyn IOInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
config: Option<IndexMap<String, PhpMixed>>,
disable_plugins: bool,
disable_scripts: Option<bool>,
@@ -387,7 +390,7 @@ impl BaseCommand for BaseCommandData {
fn get_preferred_install_options(
&self,
config: &Config,
- input: Rc<RefCell<dyn InputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
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<RefCell<dyn InputInterface>>,
- ) -> anyhow::Result<Rc<dyn PlatformRequirementFilterInterface>> {
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ ) -> anyhow::Result<std::rc::Rc<dyn PlatformRequirementFilterInterface>> {
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<PhpMixed>, output: Rc<RefCell<dyn OutputInterface>>) {
+ fn render_table(
+ &self,
+ table: Vec<PhpMixed>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) {
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<RefCell<dyn InputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
opt_name: &str,
) -> anyhow::Result<String> {
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<RefCell<dyn InputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
) -> anyhow::Result<AuditConfig> {
// 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<RefCell<dyn shirabe_external_packages::symfony::console::application::Application>>,
+ 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<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
// initialize a plugin-enabled Composer instance, either local or global
let disable_plugins = input
diff --git a/crates/shirabe/src/command/bump_command.rs b/crates/shirabe/src/command/bump_command.rs
index e3dac8a2..e6c565c1 100644
--- a/crates/shirabe/src/command/bump_command.rs
+++ b/crates/shirabe/src/command/bump_command.rs
@@ -20,8 +20,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{PhpMixed, file_get_contents, file_put_contents, is_writable, strtolower};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct BumpCommand {
@@ -388,8 +386,8 @@ impl Command for BumpCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let packages_filter: Vec<String> = input
.borrow()
@@ -430,8 +428,8 @@ impl Command for BumpCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/check_platform_reqs_command.rs b/crates/shirabe/src/command/check_platform_reqs_command.rs
index 4f53e79a..0f310ea4 100644
--- a/crates/shirabe/src/command/check_platform_reqs_command.rs
+++ b/crates/shirabe/src/command/check_platform_reqs_command.rs
@@ -17,8 +17,6 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{PhpMixed, array_merge_map, strip_tags};
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
struct CheckResult {
platform_package: String,
@@ -189,8 +187,8 @@ impl Command for CheckPlatformReqsCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.require_composer(None, None)?;
let composer = crate::composer::composer_full(&composer);
@@ -394,8 +392,8 @@ impl Command for CheckPlatformReqsCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/clear_cache_command.rs b/crates/shirabe/src/command/clear_cache_command.rs
index 2e414125..054ea8b1 100644
--- a/crates/shirabe/src/command/clear_cache_command.rs
+++ b/crates/shirabe/src/command/clear_cache_command.rs
@@ -12,8 +12,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::realpath;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct ClearCacheCommand {
@@ -62,8 +60,8 @@ impl Command for ClearCacheCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.try_composer(None, None);
// composer.getConfig() yields an Rc<RefCell<Config>>; Factory::createConfig() an owned
@@ -180,8 +178,8 @@ impl Command for ClearCacheCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/create_project_command.rs b/crates/shirabe/src/command/create_project_command.rs
index 755590f6..4544cb63 100644
--- a/crates/shirabe/src/command/create_project_command.rs
+++ b/crates/shirabe/src/command/create_project_command.rs
@@ -44,9 +44,7 @@ use shirabe_php_shim::{
UnexpectedValueException, array_pop, chdir, explode_with_limit, file_exists, getcwd, implode,
is_dir, is_file, mkdir, realpath, rtrim, strtolower, unlink,
};
-use std::cell::RefCell;
use std::path::PathBuf;
-use std::rc::Rc;
/// Install a package as new project into new directory.
#[derive(Debug)]
@@ -257,8 +255,8 @@ impl Command for CreateProjectCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/depends_command.rs b/crates/shirabe/src/command/depends_command.rs
index 00b5abcb..4c6f85b5 100644
--- a/crates/shirabe/src/command/depends_command.rs
+++ b/crates/shirabe/src/command/depends_command.rs
@@ -9,8 +9,6 @@ use crate::console::input::InputOption;
use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct DependsCommand {
@@ -101,16 +99,16 @@ impl Command for DependsCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
self.do_execute(input, output, false)
}
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/diagnose_command.rs b/crates/shirabe/src/command/diagnose_command.rs
index 0c50d695..e7fb9c74 100644
--- a/crates/shirabe/src/command/diagnose_command.rs
+++ b/crates/shirabe/src/command/diagnose_command.rs
@@ -47,8 +47,6 @@ use shirabe_php_shim::{
is_array, is_string, ob_get_clean, ob_start, phpinfo, rtrim, str_contains, str_replace,
str_starts_with, strpos, strstr, strtolower, trim, version_compare,
};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct DiagnoseCommand {
@@ -441,8 +439,8 @@ impl Command for DiagnoseCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/dump_autoload_command.rs b/crates/shirabe/src/command/dump_autoload_command.rs
index de917b5d..906185b0 100644
--- a/crates/shirabe/src/command/dump_autoload_command.rs
+++ b/crates/shirabe/src/command/dump_autoload_command.rs
@@ -11,8 +11,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed, file_exists};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct DumpAutoloadCommand {
@@ -64,8 +62,8 @@ impl Command for DumpAutoloadCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.require_composer(None, None)?;
let composer = crate::composer::composer_full(&composer);
@@ -313,8 +311,8 @@ impl Command for DumpAutoloadCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/exec_command.rs b/crates/shirabe/src/command/exec_command.rs
index 659b8f75..3eaee5a9 100644
--- a/crates/shirabe/src/command/exec_command.rs
+++ b/crates/shirabe/src/command/exec_command.rs
@@ -11,8 +11,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{PhpMixed, RuntimeException, basename, chdir, getcwd, glob};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct ExecCommand {
@@ -98,8 +96,8 @@ impl Command for ExecCommand {
fn interact(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) {
let _ = (|| -> anyhow::Result<()> {
let binaries = self.get_binaries(false)?;
@@ -140,8 +138,8 @@ impl Command for ExecCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.require_composer(None, None)?;
@@ -236,8 +234,8 @@ impl Command for ExecCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/fund_command.rs b/crates/shirabe/src/command/fund_command.rs
index 5c980314..65ae2c94 100644
--- a/crates/shirabe/src/command/fund_command.rs
+++ b/crates/shirabe/src/command/fund_command.rs
@@ -17,8 +17,6 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::MatchAllConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct FundCommand {
@@ -97,8 +95,8 @@ impl Command for FundCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.require_composer(None, None)?;
let composer = crate::composer::composer_full(&composer);
@@ -217,8 +215,8 @@ impl Command for FundCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/global_command.rs b/crates/shirabe/src/command/global_command.rs
index b0a3542d..a1f5f72e 100644
--- a/crates/shirabe/src/command/global_command.rs
+++ b/crates/shirabe/src/command/global_command.rs
@@ -16,9 +16,7 @@ use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::input::StringInput;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{LogicException, RuntimeException, chdir};
-use std::cell::RefCell;
use std::path::Path;
-use std::rc::Rc;
#[derive(Debug)]
pub struct GlobalCommand {
@@ -67,7 +65,7 @@ impl GlobalCommand {
fn prepare_subcommand_input(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
quiet: bool,
) -> anyhow::Result<StringInput> {
if Platform::get_env("COMPOSER").is_some() {
@@ -152,8 +150,8 @@ impl Command for GlobalCommand {
fn run(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let tokens = Preg::split(r"{\s+}", &Self::input_to_string(&*input.borrow())?);
let mut args: Vec<String> = vec![];
@@ -171,7 +169,8 @@ impl Command for GlobalCommand {
}
let sub_input = self.prepare_subcommand_input(input, false)?;
- let sub_input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(sub_input));
+ let sub_input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(sub_input));
let application = {
let application = self
@@ -190,8 +189,8 @@ impl Command for GlobalCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/home_command.rs b/crates/shirabe/src/command/home_command.rs
index 8ff43f39..5a823d8b 100644
--- a/crates/shirabe/src/command/home_command.rs
+++ b/crates/shirabe/src/command/home_command.rs
@@ -16,8 +16,6 @@ use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::PhpMixed;
use shirabe_php_shim::filter_var_url;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct HomeCommand {
@@ -178,8 +176,8 @@ impl Command for HomeCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let repos = self.initialize_repos()?;
let io = self.get_io().clone();
@@ -256,8 +254,8 @@ impl Command for HomeCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/init_command.rs b/crates/shirabe/src/command/init_command.rs
index 4a2e9a3d..f0f07a56 100644
--- a/crates/shirabe/src/command/init_command.rs
+++ b/crates/shirabe/src/command/init_command.rs
@@ -31,8 +31,6 @@ use shirabe_php_shim::{
is_string, preg_quote, realpath, str_replace, strpos, strtolower, trim, ucwords,
};
use shirabe_spdx_licenses::SpdxLicenses;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct InitCommand {
@@ -116,8 +114,8 @@ impl Command for InitCommand {
/// @throws \Seld\JsonLint\ParsingException
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let io = self.get_io();
@@ -402,8 +400,8 @@ impl Command for InitCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input.clone(), output.clone())?;
@@ -430,8 +428,8 @@ impl Command for InitCommand {
fn interact(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) {
let _ = (|| -> anyhow::Result<()> {
let io = self.get_io();
diff --git a/crates/shirabe/src/command/install_command.rs b/crates/shirabe/src/command/install_command.rs
index 11929689..635c1461 100644
--- a/crates/shirabe/src/command/install_command.rs
+++ b/crates/shirabe/src/command/install_command.rs
@@ -15,8 +15,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct InstallCommand {
@@ -84,8 +82,8 @@ impl Command for InstallCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let io = self.get_io().clone();
@@ -265,8 +263,8 @@ impl Command for InstallCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/licenses_command.rs b/crates/shirabe/src/command/licenses_command.rs
index 52f7d2fa..be467a13 100644
--- a/crates/shirabe/src/command/licenses_command.rs
+++ b/crates/shirabe/src/command/licenses_command.rs
@@ -20,8 +20,6 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_external_packages::symfony::console::style::StyleInterface;
use shirabe_external_packages::symfony::console::style::SymfonyStyle;
use shirabe_php_shim::{PhpMixed, RuntimeException, UnexpectedValueException};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct LicensesCommand {
@@ -91,8 +89,8 @@ impl Command for LicensesCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer_handle = self.require_composer(None, None)?;
@@ -330,8 +328,8 @@ impl Command for LicensesCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/outdated_command.rs b/crates/shirabe/src/command/outdated_command.rs
index 73f191d2..e0892692 100644
--- a/crates/shirabe/src/command/outdated_command.rs
+++ b/crates/shirabe/src/command/outdated_command.rs
@@ -11,8 +11,6 @@ use shirabe_external_packages::symfony::console::input::ArrayInput;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct OutdatedCommand {
@@ -74,8 +72,8 @@ impl Command for OutdatedCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let mut args: IndexMap<String, PhpMixed> = IndexMap::new();
args.insert("command".to_string(), PhpMixed::String("show".to_string()));
@@ -206,7 +204,8 @@ impl Command for OutdatedCommand {
None,
)?;
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(input));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(input));
let application = {
let application = self
@@ -225,8 +224,8 @@ impl Command for OutdatedCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/prohibits_command.rs b/crates/shirabe/src/command/prohibits_command.rs
index 9f9b0eea..49c8a19b 100644
--- a/crates/shirabe/src/command/prohibits_command.rs
+++ b/crates/shirabe/src/command/prohibits_command.rs
@@ -8,8 +8,6 @@ use crate::console::input::InputOption;
use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct ProhibitsCommand {
@@ -108,16 +106,16 @@ impl Command for ProhibitsCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
self.do_execute(input, output, true)
}
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/reinstall_command.rs b/crates/shirabe/src/command/reinstall_command.rs
index b28f6168..c2c3ab18 100644
--- a/crates/shirabe/src/command/reinstall_command.rs
+++ b/crates/shirabe/src/command/reinstall_command.rs
@@ -20,8 +20,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::InvalidArgumentException;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct ReinstallCommand {
@@ -79,8 +77,8 @@ impl Command for ReinstallCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.require_composer(None, None)?;
let composer = crate::composer::composer_full(&composer);
@@ -243,9 +241,9 @@ impl Command for ReinstallCommand {
indexmap::IndexMap::new(),
);
- let uninstall_operations: Vec<Rc<dyn OperationInterface>> = uninstall_operations
+ let uninstall_operations: Vec<std::rc::Rc<dyn OperationInterface>> = uninstall_operations
.into_iter()
- .map(|op| Rc::new(op) as Rc<dyn OperationInterface>)
+ .map(|op| std::rc::Rc::new(op) as std::rc::Rc<dyn OperationInterface>)
.collect();
{
let mut local_repo_ref = local_repo.borrow_mut();
@@ -356,8 +354,8 @@ impl Command for ReinstallCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/remove_command.rs b/crates/shirabe/src/command/remove_command.rs
index aa8f7723..e7686efd 100644
--- a/crates/shirabe/src/command/remove_command.rs
+++ b/crates/shirabe/src/command/remove_command.rs
@@ -21,8 +21,6 @@ use shirabe_external_packages::symfony::console::exception::InvalidArgumentExcep
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{PhpMixed, UnexpectedValueException, strtolower};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct RemoveCommand {
@@ -175,8 +173,8 @@ impl Command for RemoveCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
if input
.borrow()
@@ -713,8 +711,8 @@ impl Command for RemoveCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/repository_command.rs b/crates/shirabe/src/command/repository_command.rs
index 89fb84b4..06ecfb4f 100644
--- a/crates/shirabe/src/command/repository_command.rs
+++ b/crates/shirabe/src/command/repository_command.rs
@@ -17,8 +17,6 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{
InvalidArgumentException, PHP_URL_HOST, PhpMixed, RuntimeException, parse_url, strtolower,
};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct RepositoryCommand {
@@ -494,8 +492,8 @@ impl Command for RepositoryCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
<Self as crate::command::base_config_command::BaseConfigCommand>::initialize(
self, input, output,
diff --git a/crates/shirabe/src/command/require_command.rs b/crates/shirabe/src/command/require_command.rs
index 952f8d89..219ad3d8 100644
--- a/crates/shirabe/src/command/require_command.rs
+++ b/crates/shirabe/src/command/require_command.rs
@@ -40,8 +40,6 @@ use shirabe_php_shim::{
array_merge, array_unique, empty, file_exists, file_get_contents, file_put_contents, filesize,
implode, is_writable, strtolower, unlink,
};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct RequireCommand {
@@ -633,15 +631,15 @@ impl Command for RequireCommand {
fn interact(
&self,
- _input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) {
}
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/run_script_command.rs b/crates/shirabe/src/command/run_script_command.rs
index 7fc9703f..c256eea2 100644
--- a/crates/shirabe/src/command/run_script_command.rs
+++ b/crates/shirabe/src/command/run_script_command.rs
@@ -18,8 +18,6 @@ use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::PhpMixed;
use shirabe_php_shim::{InvalidArgumentException, RuntimeException};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct RunScriptCommand {
@@ -59,7 +57,10 @@ impl RunScriptCommand {
command
}
- fn list_scripts(&self, output: Rc<RefCell<dyn OutputInterface>>) -> anyhow::Result<i64> {
+ fn list_scripts(
+ &self,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
+ ) -> anyhow::Result<i64> {
let scripts = self.get_scripts()?;
if scripts.is_empty() {
return Ok(0);
@@ -181,8 +182,8 @@ impl Command for RunScriptCommand {
fn interact(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) {
let _ = (|| -> anyhow::Result<()> {
let scripts = self.get_scripts()?;
@@ -223,8 +224,8 @@ impl Command for RunScriptCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
if input
.borrow()
@@ -323,8 +324,8 @@ impl Command for RunScriptCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/script_alias_command.rs b/crates/shirabe/src/command/script_alias_command.rs
index ff1fd3d2..17629162 100644
--- a/crates/shirabe/src/command/script_alias_command.rs
+++ b/crates/shirabe/src/command/script_alias_command.rs
@@ -11,8 +11,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{InvalidArgumentException, LogicException, PhpMixed, is_string};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct ScriptAliasCommand {
@@ -108,8 +106,8 @@ impl Command for ScriptAliasCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.require_composer(None, None)?;
let dispatcher = crate::composer::composer_full(&composer)
@@ -164,8 +162,8 @@ impl Command for ScriptAliasCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/search_command.rs b/crates/shirabe/src/command/search_command.rs
index 89abddd7..6709613c 100644
--- a/crates/shirabe/src/command/search_command.rs
+++ b/crates/shirabe/src/command/search_command.rs
@@ -18,8 +18,6 @@ use shirabe_external_packages::symfony::console::formatter::OutputFormatter;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed, implode, in_array, preg_quote};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct SearchCommand {
@@ -104,8 +102,8 @@ impl Command for SearchCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let platform_repo = PlatformRepository::new4(vec![], IndexMap::new(), None, None)?;
let io = self.get_io();
@@ -271,8 +269,8 @@ impl Command for SearchCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/self_update_command.rs b/crates/shirabe/src/command/self_update_command.rs
index 35a1374b..87efd4b9 100644
--- a/crates/shirabe/src/command/self_update_command.rs
+++ b/crates/shirabe/src/command/self_update_command.rs
@@ -11,8 +11,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct SelfUpdateCommand {
@@ -72,8 +70,8 @@ impl Command for SelfUpdateCommand {
/// been published yet. The command is therefore disabled.
fn execute(
&self,
- _input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ _input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let io = self.get_io();
io.write_error3(
@@ -87,8 +85,8 @@ impl Command for SelfUpdateCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs
index 68b42e68..a63e08cf 100644
--- a/crates/shirabe/src/command/show_command.rs
+++ b/crates/shirabe/src/command/show_command.rs
@@ -47,8 +47,6 @@ use shirabe_php_shim::{
use shirabe_semver::Semver;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_spdx_licenses::SpdxLicenses;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct ShowCommand {
@@ -209,8 +207,8 @@ impl Command for ShowCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
*self.version_parser.borrow_mut() = VersionParser::new();
if input.borrow().get_option("tree")?.as_bool() == Some(true) {
@@ -1443,8 +1441,8 @@ impl Command for ShowCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/status_command.rs b/crates/shirabe/src/command/status_command.rs
index 3b3445b6..b527d5aa 100644
--- a/crates/shirabe/src/command/status_command.rs
+++ b/crates/shirabe/src/command/status_command.rs
@@ -16,8 +16,6 @@ use indexmap::IndexMap;
use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct StatusCommand {
@@ -335,8 +333,8 @@ impl Command for StatusCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer_rc = self.require_composer(None, None)?;
{
@@ -381,8 +379,8 @@ impl Command for StatusCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/suggests_command.rs b/crates/shirabe/src/command/suggests_command.rs
index f7b04142..e42f20ba 100644
--- a/crates/shirabe/src/command/suggests_command.rs
+++ b/crates/shirabe/src/command/suggests_command.rs
@@ -15,8 +15,6 @@ use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_php_shim::{PhpMixed, empty, in_array};
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct SuggestsCommand {
@@ -109,8 +107,8 @@ impl Command for SuggestsCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- _output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ _output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let composer = self.require_composer(None, None)?;
let composer = crate::composer::composer_full(&composer);
@@ -215,8 +213,8 @@ impl Command for SuggestsCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs
index 366cf8bb..0163f6bc 100644
--- a/crates/shirabe/src/command/update_command.rs
+++ b/crates/shirabe/src/command/update_command.rs
@@ -35,8 +35,6 @@ use shirabe_php_shim::{
};
use shirabe_semver::Intervals;
use shirabe_semver::constraint::MultiConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct UpdateCommand {
@@ -124,8 +122,8 @@ impl Command for UpdateCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let io = self.get_io().clone();
if input.borrow().get_option("dev")?.as_bool().unwrap_or(false) {
@@ -572,8 +570,8 @@ impl Command for UpdateCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/command/validate_command.rs b/crates/shirabe/src/command/validate_command.rs
index bceaa991..12e28188 100644
--- a/crates/shirabe/src/command/validate_command.rs
+++ b/crates/shirabe/src/command/validate_command.rs
@@ -16,8 +16,6 @@ use crate::util::Filesystem;
use shirabe_external_packages::symfony::console::command::command::Command;
use shirabe_external_packages::symfony::console::input::InputInterface;
use shirabe_external_packages::symfony::console::output::OutputInterface;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct ValidateCommand {
@@ -132,8 +130,8 @@ impl Command for ValidateCommand {
fn execute(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<i64> {
let file = input
.borrow()
@@ -303,8 +301,8 @@ impl Command for ValidateCommand {
fn initialize(
&self,
- input: Rc<RefCell<dyn InputInterface>>,
- output: Rc<RefCell<dyn OutputInterface>>,
+ input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>>,
+ output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
) -> anyhow::Result<()> {
base_command_initialize(self, input, output)
}
diff --git a/crates/shirabe/src/config.rs b/crates/shirabe/src/config.rs
index cac6181e..d1cd4212 100644
--- a/crates/shirabe/src/config.rs
+++ b/crates/shirabe/src/config.rs
@@ -15,7 +15,6 @@ use shirabe_php_shim::{
is_array, is_string, parse_url, php_to_string, rtrim, strtolower, strtoupper, strtr, substr,
trigger_error,
};
-use std::cell::RefCell;
use crate::advisory::Auditor;
use crate::downloader::TransportException;
@@ -40,7 +39,7 @@ pub struct Config {
warned_hosts: IndexMap<String, bool>,
/// @var array<string, true>
ssl_verify_warned_hosts: IndexMap<String, bool>,
- source_of_config_value: RefCell<IndexMap<String, String>>,
+ source_of_config_value: std::cell::RefCell<IndexMap<String, String>>,
}
impl Config {
@@ -229,7 +228,7 @@ impl Config {
local_auth_config_source: None,
warned_hosts: IndexMap::new(),
ssl_verify_warned_hosts: IndexMap::new(),
- source_of_config_value: RefCell::new(IndexMap::new()),
+ source_of_config_value: std::cell::RefCell::new(IndexMap::new()),
};
let config_clone = this.config.clone();
diff --git a/crates/shirabe/src/console/application.rs b/crates/shirabe/src/console/application.rs
index 86639444..a2f36cf4 100644
--- a/crates/shirabe/src/console/application.rs
+++ b/crates/shirabe/src/console/application.rs
@@ -833,7 +833,7 @@ impl Application {
return self
.shared()
.add(todo!(
- "Rc<RefCell<dyn SymfonyCommand>> from command_loader.get(name)"
+ "std::rc::Rc<std::cell::RefCell<dyn SymfonyCommand>> from command_loader.get(name)"
))
.map(|c| c.is_some())
.unwrap_or(false);
@@ -1052,7 +1052,7 @@ impl Application {
command_list.insert(
name_or_alias.clone(),
todo!(
- "Rc<RefCell<dyn SymfonyCommand>> from command_loader.get(name_or_alias)"
+ "std::rc::Rc<std::cell::RefCell<dyn SymfonyCommand>> from command_loader.get(name_or_alias)"
),
);
}
diff --git a/crates/shirabe/src/dependency_resolver/default_policy.rs b/crates/shirabe/src/dependency_resolver/default_policy.rs
index d56a96c5..e7d02e24 100644
--- a/crates/shirabe/src/dependency_resolver/default_policy.rs
+++ b/crates/shirabe/src/dependency_resolver/default_policy.rs
@@ -8,7 +8,6 @@ use crate::util::Platform;
use indexmap::IndexMap;
use shirabe_semver::CompilingMatcher;
use shirabe_semver::constraint::SimpleConstraint;
-use std::cell::RefCell;
#[derive(Debug)]
pub struct DefaultPolicy {
@@ -16,8 +15,9 @@ pub struct DefaultPolicy {
prefer_lowest: bool,
prefer_dev_over_prerelease: bool,
preferred_versions: Option<IndexMap<String, String>>,
- preferred_package_result_cache_per_pool: RefCell<IndexMap<i64, IndexMap<String, Vec<i64>>>>,
- sorting_cache_per_pool: RefCell<IndexMap<i64, IndexMap<String, i64>>>,
+ preferred_package_result_cache_per_pool:
+ std::cell::RefCell<IndexMap<i64, IndexMap<String, Vec<i64>>>>,
+ sorting_cache_per_pool: std::cell::RefCell<IndexMap<i64, IndexMap<String, i64>>>,
}
impl DefaultPolicy {
@@ -33,8 +33,8 @@ impl DefaultPolicy {
prefer_dev_over_prerelease: Platform::get_env("COMPOSER_PREFER_DEV_OVER_PRERELEASE")
.map(|v| !v.is_empty())
.unwrap_or(false),
- preferred_package_result_cache_per_pool: RefCell::new(IndexMap::new()),
- sorting_cache_per_pool: RefCell::new(IndexMap::new()),
+ preferred_package_result_cache_per_pool: std::cell::RefCell::new(IndexMap::new()),
+ sorting_cache_per_pool: std::cell::RefCell::new(IndexMap::new()),
}
}
diff --git a/crates/shirabe/src/dependency_resolver/pool_optimizer.rs b/crates/shirabe/src/dependency_resolver/pool_optimizer.rs
index 6238ddbe..789d0aed 100644
--- a/crates/shirabe/src/dependency_resolver/pool_optimizer.rs
+++ b/crates/shirabe/src/dependency_resolver/pool_optimizer.rs
@@ -12,13 +12,12 @@ use shirabe_semver::Intervals;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::MultiConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-use std::rc::Rc;
/// Optimizes a given pool
#[derive(Debug)]
pub struct PoolOptimizer {
/// @var PolicyInterface
- policy: Rc<dyn PolicyInterface>,
+ policy: std::rc::Rc<dyn PolicyInterface>,
/// @var array<int, true>
irremovable_packages: IndexMap<i64, bool>,
@@ -46,7 +45,7 @@ struct IdenticalDefinitionPointers {
}
impl PoolOptimizer {
- pub fn new(policy: Rc<dyn PolicyInterface>) -> Self {
+ pub fn new(policy: std::rc::Rc<dyn PolicyInterface>) -> Self {
Self {
policy,
irremovable_packages: IndexMap::new(),
diff --git a/crates/shirabe/src/dependency_resolver/rule.rs b/crates/shirabe/src/dependency_resolver/rule.rs
index ab4eeb0c..e1572b0b 100644
--- a/crates/shirabe/src/dependency_resolver/rule.rs
+++ b/crates/shirabe/src/dependency_resolver/rule.rs
@@ -18,8 +18,6 @@ use shirabe_php_shim::{
};
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub enum ReasonData {
@@ -323,7 +321,7 @@ impl Rule {
pool: &mut Pool,
is_verbose: bool,
installed_map: &IndexMap<String, BasePackageHandle>,
- _learned_pool: &Vec<Vec<Rc<RefCell<Rule>>>>,
+ _learned_pool: &Vec<Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>,
) -> anyhow::Result<String> {
let mut literals = self.get_literals();
diff --git a/crates/shirabe/src/dependency_resolver/rule_set.rs b/crates/shirabe/src/dependency_resolver/rule_set.rs
index cde4ebca..f7300d93 100644
--- a/crates/shirabe/src/dependency_resolver/rule_set.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_set.rs
@@ -7,15 +7,13 @@ use crate::dependency_resolver::RuleSetIterator;
use crate::repository::RepositorySet;
use indexmap::IndexMap;
use shirabe_php_shim::OutOfBoundsException;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct RuleSet {
- pub rule_by_id: IndexMap<i64, Rc<RefCell<Rule>>>,
- pub(crate) rules: IndexMap<i64, Vec<Rc<RefCell<Rule>>>>,
+ pub rule_by_id: IndexMap<i64, std::rc::Rc<std::cell::RefCell<Rule>>>,
+ pub(crate) rules: IndexMap<i64, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>,
pub(crate) next_rule_id: i64,
- pub(crate) rules_by_hash: IndexMap<String, Vec<Rc<RefCell<Rule>>>>,
+ pub(crate) rules_by_hash: IndexMap<String, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>,
}
impl Default for RuleSet {
@@ -54,7 +52,11 @@ impl RuleSet {
Self::types().into_keys().collect()
}
- pub fn add(&mut self, rule: Rc<RefCell<Rule>>, r#type: i64) -> anyhow::Result<()> {
+ pub fn add(
+ &mut self,
+ rule: std::rc::Rc<std::cell::RefCell<Rule>>,
+ r#type: i64,
+ ) -> anyhow::Result<()> {
let types = Self::types();
if !types.contains_key(&r#type) {
return Err(OutOfBoundsException {
@@ -92,11 +94,11 @@ impl RuleSet {
self.next_rule_id
}
- pub fn rule_by_id(&self, id: i64) -> Rc<RefCell<Rule>> {
+ pub fn rule_by_id(&self, id: i64) -> std::rc::Rc<std::cell::RefCell<Rule>> {
self.rule_by_id[&id].clone()
}
- pub fn get_rules(&self) -> &IndexMap<i64, Vec<Rc<RefCell<Rule>>>> {
+ pub fn get_rules(&self) -> &IndexMap<i64, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>> {
&self.rules
}
@@ -105,7 +107,7 @@ impl RuleSet {
}
pub fn get_iterator_for(&self, types: Vec<i64>) -> RuleSetIterator {
- let mut rules: IndexMap<i64, Vec<Rc<RefCell<Rule>>>> = IndexMap::new();
+ let mut rules: IndexMap<i64, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>> = IndexMap::new();
for r#type in types {
if let Some(rules_for_type) = self.rules.get(&r#type) {
rules.insert(r#type, rules_for_type.clone());
@@ -115,7 +117,7 @@ impl RuleSet {
}
pub fn get_iterator_without(&self, types: Vec<i64>) -> RuleSetIterator {
- let mut rules: IndexMap<i64, Vec<Rc<RefCell<Rule>>>> = IndexMap::new();
+ let mut rules: IndexMap<i64, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>> = IndexMap::new();
for (r#type, rules_for_type) in &self.rules {
if types.contains(r#type) {
continue;
diff --git a/crates/shirabe/src/dependency_resolver/rule_set_generator.rs b/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
index 6c2824e4..2f4837d4 100644
--- a/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_set_generator.rs
@@ -13,13 +13,11 @@ use crate::filter::platform_requirement_filter::PlatformRequirementFilterFactory
use crate::filter::platform_requirement_filter::PlatformRequirementFilterInterface;
use crate::package::PackageInterfaceHandle;
use indexmap::IndexMap;
-use std::cell::RefCell;
use std::collections::VecDeque;
-use std::rc::Rc;
#[derive(Debug)]
pub struct RuleSetGenerator {
- pub(crate) policy: Rc<dyn PolicyInterface>,
+ pub(crate) policy: std::rc::Rc<dyn PolicyInterface>,
pub(crate) pool: std::rc::Rc<std::cell::RefCell<Pool>>,
pub(crate) rules: RuleSet,
pub(crate) added_map: IndexMap<i64, PackageInterfaceHandle>,
@@ -28,7 +26,7 @@ pub struct RuleSetGenerator {
impl RuleSetGenerator {
pub fn new(
- policy: Rc<dyn PolicyInterface>,
+ policy: std::rc::Rc<dyn PolicyInterface>,
pool: std::rc::Rc<std::cell::RefCell<Pool>>,
) -> Self {
Self {
@@ -128,7 +126,9 @@ impl RuleSetGenerator {
/// methods null is allowed which will not insert a rule.
fn add_rule(&mut self, r#type: i64, new_rule: Option<Rule>) {
if let Some(rule) = new_rule {
- self.rules.add(Rc::new(RefCell::new(rule)), r#type).ok();
+ self.rules
+ .add(std::rc::Rc::new(std::cell::RefCell::new(rule)), r#type)
+ .ok();
}
}
@@ -397,7 +397,7 @@ impl RuleSetGenerator {
pub fn get_rules_for(
&mut self,
request: &Request,
- platform_requirement_filter: Option<Rc<dyn PlatformRequirementFilterInterface>>,
+ platform_requirement_filter: Option<std::rc::Rc<dyn PlatformRequirementFilterInterface>>,
) -> anyhow::Result<RuleSet> {
let platform_requirement_filter = platform_requirement_filter
.unwrap_or_else(PlatformRequirementFilterFactory::ignore_nothing);
diff --git a/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs b/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs
index 2c4b9a45..b469a193 100644
--- a/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_set_iterator.rs
@@ -2,13 +2,11 @@
use crate::dependency_resolver::Rule;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
/// Implements PHP \Iterator over a grouped rule set.
#[derive(Debug)]
pub struct RuleSetIterator {
- pub(crate) rules: IndexMap<i64, Vec<Rc<RefCell<Rule>>>>,
+ pub(crate) rules: IndexMap<i64, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>,
pub(crate) types: Vec<i64>,
pub(crate) current_offset: i64,
pub(crate) current_type: i64,
@@ -16,7 +14,7 @@ pub struct RuleSetIterator {
}
impl RuleSetIterator {
- pub fn new(rules: IndexMap<i64, Vec<Rc<RefCell<Rule>>>>) -> Self {
+ pub fn new(rules: IndexMap<i64, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>) -> Self {
let mut types: Vec<i64> = rules.keys().copied().collect();
types.sort();
let mut iter = Self {
@@ -30,7 +28,7 @@ impl RuleSetIterator {
iter
}
- pub fn current(&self) -> Rc<RefCell<Rule>> {
+ pub fn current(&self) -> std::rc::Rc<std::cell::RefCell<Rule>> {
self.rules[&self.current_type][self.current_offset as usize].clone()
}
diff --git a/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs b/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs
index b746f504..6646490b 100644
--- a/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_watch_graph.rs
@@ -5,8 +5,6 @@ use crate::dependency_resolver::Rule;
use crate::dependency_resolver::RuleWatchChain;
use crate::dependency_resolver::RuleWatchNode;
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct RuleWatchGraph {
@@ -26,7 +24,7 @@ impl RuleWatchGraph {
}
}
- pub fn insert(&mut self, node: Rc<RefCell<RuleWatchNode>>) {
+ pub fn insert(&mut self, node: std::rc::Rc<std::cell::RefCell<RuleWatchNode>>) {
if node.borrow().get_rule().borrow().is_assertion() {
return;
}
@@ -64,7 +62,7 @@ impl RuleWatchGraph {
decided_literal: i64,
level: i64,
decisions: &mut Decisions,
- ) -> Option<Rc<RefCell<Rule>>> {
+ ) -> Option<std::rc::Rc<std::cell::RefCell<Rule>>> {
let literal = -decided_literal;
if !self.watch_chains.contains_key(&literal) {
@@ -127,7 +125,7 @@ impl RuleWatchGraph {
&mut self,
from_literal: i64,
to_literal: i64,
- node: Rc<RefCell<RuleWatchNode>>,
+ node: std::rc::Rc<std::cell::RefCell<RuleWatchNode>>,
) {
if !self.watch_chains.contains_key(&to_literal) {
self.watch_chains.insert(to_literal, RuleWatchChain::new());
diff --git a/crates/shirabe/src/dependency_resolver/rule_watch_node.rs b/crates/shirabe/src/dependency_resolver/rule_watch_node.rs
index 92faae72..b11c1771 100644
--- a/crates/shirabe/src/dependency_resolver/rule_watch_node.rs
+++ b/crates/shirabe/src/dependency_resolver/rule_watch_node.rs
@@ -2,13 +2,11 @@
use crate::dependency_resolver::Decisions;
use crate::dependency_resolver::Rule;
-use std::cell::RefCell;
-use std::rc::Rc;
pub struct RuleWatchNode {
pub watch1: i64,
pub watch2: i64,
- pub(crate) rule: Rc<RefCell<Rule>>,
+ pub(crate) rule: std::rc::Rc<std::cell::RefCell<Rule>>,
}
impl std::fmt::Debug for RuleWatchNode {
@@ -21,7 +19,7 @@ impl std::fmt::Debug for RuleWatchNode {
}
impl RuleWatchNode {
- pub fn new(rule: Rc<RefCell<Rule>>) -> Self {
+ pub fn new(rule: std::rc::Rc<std::cell::RefCell<Rule>>) -> Self {
let literals = rule.borrow().get_literals();
let literal_count = literals.len();
let watch1 = if literal_count > 0 { literals[0] } else { 0 };
@@ -54,7 +52,7 @@ impl RuleWatchNode {
}
}
- pub fn get_rule(&self) -> Rc<RefCell<Rule>> {
+ pub fn get_rule(&self) -> std::rc::Rc<std::cell::RefCell<Rule>> {
self.rule.clone()
}
diff --git a/crates/shirabe/src/dependency_resolver/solver.rs b/crates/shirabe/src/dependency_resolver/solver.rs
index 933f79f5..960cd7a6 100644
--- a/crates/shirabe/src/dependency_resolver/solver.rs
+++ b/crates/shirabe/src/dependency_resolver/solver.rs
@@ -23,12 +23,10 @@ use crate::package::BasePackageHandle;
use indexmap::IndexMap;
use shirabe_php_shim::{array_shift, array_unshift, microtime, spl_object_hash};
use shirabe_semver::constraint::AnyConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct Solver {
- pub(crate) policy: Rc<dyn PolicyInterface>,
+ pub(crate) policy: std::rc::Rc<dyn PolicyInterface>,
pub(crate) pool: std::rc::Rc<std::cell::RefCell<Pool>>,
pub(crate) rules: RuleSet,
@@ -41,7 +39,7 @@ pub struct Solver {
/// Pairs of `(literals, level)` — PHP indexes into these with the BRANCH_* constants.
pub(crate) branches: Vec<(Vec<i64>, i64)>,
pub(crate) problems: Vec<Problem>,
- pub(crate) learned_pool: Vec<Vec<Rc<RefCell<Rule>>>>,
+ pub(crate) learned_pool: Vec<Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>,
pub(crate) learned_why: IndexMap<String, i64>,
pub test_flag_learned_positive_literal: bool,
@@ -54,7 +52,7 @@ impl Solver {
const BRANCH_LEVEL: usize = 1;
pub fn new(
- policy: Rc<dyn PolicyInterface>,
+ policy: std::rc::Rc<dyn PolicyInterface>,
pool: std::rc::Rc<std::cell::RefCell<Pool>>,
io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
) -> Self {
@@ -205,14 +203,16 @@ impl Solver {
.is_empty()
{
let mut problem = Problem::new();
- problem.add_rule(Rc::new(RefCell::new(Rule::Generic(GenericRule::new(
- Vec::new(),
- rule::RULE_ROOT_REQUIRE,
- rule::ReasonData::RootRequire {
- package_name: package_name.clone(),
- constraint: active_constraint.clone(),
- },
- )))));
+ problem.add_rule(std::rc::Rc::new(std::cell::RefCell::new(Rule::Generic(
+ GenericRule::new(
+ Vec::new(),
+ rule::RULE_ROOT_REQUIRE,
+ rule::ReasonData::RootRequire {
+ package_name: package_name.clone(),
+ constraint: active_constraint.clone(),
+ },
+ ),
+ ))));
self.problems.push(problem);
}
}
@@ -223,7 +223,7 @@ impl Solver {
pub fn solve(
&mut self,
request: &Request,
- platform_requirement_filter: Option<Rc<dyn PlatformRequirementFilterInterface>>,
+ platform_requirement_filter: Option<std::rc::Rc<dyn PlatformRequirementFilterInterface>>,
) -> anyhow::Result<Result<LockTransaction, SolverProblemsException>> {
let platform_requirement_filter = platform_requirement_filter
.unwrap_or_else(|| PlatformRequirementFilterFactory::ignore_nothing());
@@ -244,7 +244,9 @@ impl Solver {
while iterator.valid() {
let rule = iterator.current();
self.watch_graph
- .insert(Rc::new(RefCell::new(RuleWatchNode::new(rule))));
+ .insert(std::rc::Rc::new(std::cell::RefCell::new(
+ RuleWatchNode::new(rule),
+ )));
iterator.next();
}
@@ -293,7 +295,7 @@ impl Solver {
/// If we find unit rules we make new decisions based on them
///
/// Returns a `Rule` on conflict, otherwise `None`.
- fn propagate(&mut self, level: i64) -> Option<Rc<RefCell<Rule>>> {
+ fn propagate(&mut self, level: i64) -> Option<std::rc::Rc<std::cell::RefCell<Rule>>> {
while self.decisions.valid_offset(self.propagate_index) {
let decision = self
.decisions
@@ -354,7 +356,7 @@ impl Solver {
&mut self,
level: i64,
literal: i64,
- rule: Rc<RefCell<Rule>>,
+ rule: std::rc::Rc<std::cell::RefCell<Rule>>,
) -> anyhow::Result<i64> {
let mut level = level + 1;
@@ -390,13 +392,15 @@ impl Solver {
// The same learned rule instance is shared between RuleSet,
// RuleWatchGraph, and Decisions (PHP shares one object).
- let new_rule = Rc::new(RefCell::new(Rule::Generic(new_rule)));
+ let new_rule = std::rc::Rc::new(std::cell::RefCell::new(Rule::Generic(new_rule)));
self.rules.add(new_rule.clone(), RuleSet::TYPE_LEARNED)?;
self.learned_why
.insert(spl_object_hash(&*new_rule.borrow()), why);
- let rule_node = Rc::new(RefCell::new(RuleWatchNode::new(new_rule.clone())));
+ let rule_node = std::rc::Rc::new(std::cell::RefCell::new(RuleWatchNode::new(
+ new_rule.clone(),
+ )));
rule_node.borrow_mut().watch2_on_highest(&self.decisions);
self.watch_graph.insert(rule_node);
@@ -410,7 +414,7 @@ impl Solver {
&mut self,
level: i64,
decision_queue: Vec<i64>,
- rule: Rc<RefCell<Rule>>,
+ rule: std::rc::Rc<std::cell::RefCell<Rule>>,
) -> anyhow::Result<i64> {
// choose best package to install from decisionQueue
let mut literals = self.policy.select_preferred_packages(
@@ -433,7 +437,7 @@ impl Solver {
fn analyze(
&mut self,
level: i64,
- rule: Rc<RefCell<Rule>>,
+ rule: std::rc::Rc<std::cell::RefCell<Rule>>,
) -> anyhow::Result<(i64, i64, GenericRule, i64)> {
let analyzed_rule = rule.clone();
let mut rule = rule;
@@ -602,7 +606,7 @@ impl Solver {
fn analyze_unsolvable_rule(
&self,
problem: &mut Problem,
- conflict_rule: Rc<RefCell<Rule>>,
+ conflict_rule: std::rc::Rc<std::cell::RefCell<Rule>>,
rule_seen: &mut IndexMap<String, bool>,
) {
let why = spl_object_hash(&*conflict_rule.borrow());
@@ -630,7 +634,7 @@ impl Solver {
problem.add_rule(conflict_rule);
}
- fn analyze_unsolvable(&mut self, conflict_rule: Rc<RefCell<Rule>>) {
+ fn analyze_unsolvable(&mut self, conflict_rule: std::rc::Rc<std::cell::RefCell<Rule>>) {
let mut problem = Problem::new();
problem.add_rule(conflict_rule.clone());
diff --git a/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs b/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs
index b0016d07..48fe76b3 100644
--- a/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs
+++ b/crates/shirabe/src/dependency_resolver/solver_problems_exception.rs
@@ -7,14 +7,12 @@ use crate::dependency_resolver::Rule;
use crate::repository::RepositorySet;
use crate::util::IniHelper;
use shirabe_php_shim::RuntimeException;
-use std::cell::RefCell;
-use std::rc::Rc;
#[derive(Debug)]
pub struct SolverProblemsException {
inner: RuntimeException,
pub(crate) problems: Vec<Problem>,
- pub(crate) learned_pool: Vec<Vec<Rc<RefCell<Rule>>>>,
+ pub(crate) learned_pool: Vec<Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>,
}
impl SolverProblemsException {
@@ -28,7 +26,10 @@ impl SolverProblemsException {
&self.inner.message
}
- pub fn new(problems: Vec<Problem>, learned_pool: Vec<Vec<Rc<RefCell<Rule>>>>) -> Self {
+ pub fn new(
+ problems: Vec<Problem>,
+ learned_pool: Vec<Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>,
+ ) -> Self {
let message = format!(
"Failed resolving dependencies with {} problems, call getPrettyString to get formatted details",
problems.len()
@@ -154,7 +155,7 @@ impl SolverProblemsException {
fn get_extension_problems(
&self,
- reason_sets: &indexmap::IndexMap<i64, Vec<Rc<RefCell<Rule>>>>,
+ reason_sets: &indexmap::IndexMap<i64, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>,
) -> Vec<String> {
let mut missing_extensions: indexmap::IndexMap<String, i64> = indexmap::IndexMap::new();
for reason_set in reason_sets.values() {
diff --git a/crates/shirabe/src/filter/platform_requirement_filter/platform_requirement_filter_factory.rs b/crates/shirabe/src/filter/platform_requirement_filter/platform_requirement_filter_factory.rs
index dcfd5191..12c69091 100644
--- a/crates/shirabe/src/filter/platform_requirement_filter/platform_requirement_filter_factory.rs
+++ b/crates/shirabe/src/filter/platform_requirement_filter/platform_requirement_filter_factory.rs
@@ -7,14 +7,13 @@ use crate::filter::platform_requirement_filter::{
platform_requirement_filter_interface::PlatformRequirementFilterInterface,
};
use shirabe_php_shim::{InvalidArgumentException, PhpMixed};
-use std::rc::Rc;
pub struct PlatformRequirementFilterFactory;
impl PlatformRequirementFilterFactory {
pub fn from_bool_or_list(
bool_or_list: PhpMixed,
- ) -> anyhow::Result<Rc<dyn PlatformRequirementFilterInterface>> {
+ ) -> anyhow::Result<std::rc::Rc<dyn PlatformRequirementFilterInterface>> {
match bool_or_list {
PhpMixed::Bool(b) => {
if b {
@@ -35,7 +34,9 @@ impl PlatformRequirementFilterFactory {
.collect(),
_ => unreachable!(),
};
- Ok(Rc::new(IgnoreListPlatformRequirementFilter::new(list)?))
+ Ok(std::rc::Rc::new(IgnoreListPlatformRequirementFilter::new(
+ list,
+ )?))
}
other => Err(anyhow::anyhow!(InvalidArgumentException {
message: format!(
@@ -47,11 +48,11 @@ impl PlatformRequirementFilterFactory {
}
}
- pub fn ignore_all() -> Rc<dyn PlatformRequirementFilterInterface> {
- Rc::new(IgnoreAllPlatformRequirementFilter)
+ pub fn ignore_all() -> std::rc::Rc<dyn PlatformRequirementFilterInterface> {
+ std::rc::Rc::new(IgnoreAllPlatformRequirementFilter)
}
- pub fn ignore_nothing() -> Rc<dyn PlatformRequirementFilterInterface> {
- Rc::new(IgnoreNothingPlatformRequirementFilter)
+ pub fn ignore_nothing() -> std::rc::Rc<dyn PlatformRequirementFilterInterface> {
+ std::rc::Rc::new(IgnoreNothingPlatformRequirementFilter)
}
}
diff --git a/crates/shirabe/src/installer/installation_manager.rs b/crates/shirabe/src/installer/installation_manager.rs
index 04bff2a5..a3e429b1 100644
--- a/crates/shirabe/src/installer/installation_manager.rs
+++ b/crates/shirabe/src/installer/installation_manager.rs
@@ -737,7 +737,7 @@ impl InstallationManager {
// PHP appends a post-exec step to the promise chain that dispatches the
// POST_PACKAGE_* event via the event dispatcher with repo/all_operations/operation.
// TODO(phase-c): the callback captures the event dispatcher (&mut) and the operation
- // and must outlive the loop body; that requires the dispatcher behind Rc<RefCell>
+ // and must outlive the loop body; that requires the dispatcher behind Rc<RefCell<_>>
// and the deferred event dispatch to be wired into the promise chain (todo!()).
let _ = event_name_post;
post_exec_callbacks.push(Box::new(|| {
diff --git a/crates/shirabe/src/io/console_io.rs b/crates/shirabe/src/io/console_io.rs
index eb7ab317..fe796d9e 100644
--- a/crates/shirabe/src/io/console_io.rs
+++ b/crates/shirabe/src/io/console_io.rs
@@ -27,7 +27,6 @@ use shirabe_php_shim::{
PhpMixed, array_search, function_exists, implode, in_array, is_array, is_string,
mb_check_encoding, mb_convert_encoding, microtime, str_repeat, strip_tags, strlen,
};
-use std::cell::RefCell;
/// The Input/Output helper.
#[derive(Debug)]
@@ -41,10 +40,10 @@ pub struct ConsoleIO {
/// `$this->helperSet->get('question')` on every ask. The Application class, which constructs
/// this class, registers a single `QuestionHelper`. So this port holds the `QuestionHelper`
/// directly instead of a `HelperSet`.
- question_helper: RefCell<QuestionHelper>,
+ question_helper: std::cell::RefCell<QuestionHelper>,
- pub(crate) last_message: RefCell<String>,
- pub(crate) last_message_err: RefCell<String>,
+ pub(crate) last_message: std::cell::RefCell<String>,
+ pub(crate) last_message_err: std::cell::RefCell<String>,
start_time: Option<f64>,
verbosity_map: IndexMap<i64, i64>,
@@ -69,9 +68,9 @@ impl ConsoleIO {
authentications: indexmap![],
input,
output,
- question_helper: RefCell::new(question_helper),
- last_message: RefCell::new(String::new()),
- last_message_err: RefCell::new(String::new()),
+ question_helper: std::cell::RefCell::new(question_helper),
+ last_message: std::cell::RefCell::new(String::new()),
+ last_message_err: std::cell::RefCell::new(String::new()),
start_time: None,
verbosity_map,
}
diff --git a/crates/shirabe/src/io/io_interface.rs b/crates/shirabe/src/io/io_interface.rs
index af3f688a..96bc1980 100644
--- a/crates/shirabe/src/io/io_interface.rs
+++ b/crates/shirabe/src/io/io_interface.rs
@@ -3,8 +3,6 @@
use crate::config::Config;
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
pub const QUIET: i64 = 1;
pub const NORMAL: i64 = 2;
@@ -167,7 +165,7 @@ pub trait IOInterface: IOInterfaceImmutable + IOInterfaceMutable {
// `load_configuration`) are reached via `io.borrow_mut()`. Because the handle
// does not implement `IOInterfaceMutable`, calling those directly on the handle
// is a compile error rather than a runtime panic.
-impl IOInterfaceImmutable for Rc<RefCell<dyn IOInterface>> {
+impl IOInterfaceImmutable for std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
fn is_interactive(&self) -> bool {
self.borrow().is_interactive()
}
diff --git a/crates/shirabe/src/package/handle.rs b/crates/shirabe/src/package/handle.rs
index c1db49c1..2b23a8c2 100644
--- a/crates/shirabe/src/package/handle.rs
+++ b/crates/shirabe/src/package/handle.rs
@@ -7,8 +7,6 @@ use crate::package::{
AliasPackage, BasePackage, CompleteAliasPackage, CompletePackage, CompletePackageInterface,
Package, PackageInterface, RootAliasPackage, RootPackage, RootPackageInterface,
};
-use std::cell::RefCell;
-use std::rc::Rc;
/// Any package type.
#[derive(Debug, Clone)]
@@ -192,7 +190,7 @@ impl AnyPackage {
// parent::__clone();
// $this->aliasOf = clone $this->aliasOf;
let new_alias_of_inner = p.alias_of.0.borrow().dup();
- let new_alias_of_rc = Rc::new(RefCell::new(new_alias_of_inner));
+ let new_alias_of_rc = std::rc::Rc::new(std::cell::RefCell::new(new_alias_of_inner));
let new_root = RootPackageHandle(new_alias_of_rc.clone());
let new_complete = CompletePackageHandle(new_alias_of_rc.clone());
let new_pkg = PackageHandle(new_alias_of_rc);
@@ -1361,7 +1359,7 @@ macro_rules! impl_handle_upcast {
/// Shared reference to any package. Corresponds to PHP `PackageInterface`.
#[derive(Debug, Clone)]
-pub struct PackageInterfaceHandle(Rc<RefCell<AnyPackage>>);
+pub struct PackageInterfaceHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
/// Shared reference to any package. Corresponds to PHP `BasePackage`.
/// It is exactly the same as `PackageInterface` in Shirabe. It is only for mirroing PHP type
@@ -1370,35 +1368,35 @@ pub type BasePackageHandle = PackageInterfaceHandle;
/// Shared reference to a complete package. Corresponds to PHP `CompletePackageInterface`.
#[derive(Debug, Clone)]
-pub struct CompletePackageInterfaceHandle(Rc<RefCell<AnyPackage>>);
+pub struct CompletePackageInterfaceHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
/// Shared reference to a root package. Corresponds to PHP `RootPackageInterface`.
#[derive(Debug, Clone)]
-pub struct RootPackageInterfaceHandle(Rc<RefCell<AnyPackage>>);
+pub struct RootPackageInterfaceHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
/// Shared reference to a real (non-alias) package. Corresponds to PHP `Package`.
#[derive(Debug, Clone)]
-pub struct PackageHandle(Rc<RefCell<AnyPackage>>);
+pub struct PackageHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
/// Shared reference to a real complete package. Corresponds to PHP `CompletePackage`.
#[derive(Debug, Clone)]
-pub struct CompletePackageHandle(Rc<RefCell<AnyPackage>>);
+pub struct CompletePackageHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
/// Shared reference to a real root package. Corresponds to PHP `RootPackage`.
#[derive(Debug, Clone)]
-pub struct RootPackageHandle(Rc<RefCell<AnyPackage>>);
+pub struct RootPackageHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
/// Shared reference to an alias package. Corresponds to PHP `AliasPackage`.
#[derive(Debug, Clone)]
-pub struct AliasPackageHandle(Rc<RefCell<AnyPackage>>);
+pub struct AliasPackageHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
/// Shared reference to a complete alias package. Corresponds to PHP `CompleteAliasPackage`.
#[derive(Debug, Clone)]
-pub struct CompleteAliasPackageHandle(Rc<RefCell<AnyPackage>>);
+pub struct CompleteAliasPackageHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
/// Shared reference to a root alias package. Corresponds to PHP `RootAliasPackage`.
#[derive(Debug, Clone)]
-pub struct RootAliasPackageHandle(Rc<RefCell<AnyPackage>>);
+pub struct RootAliasPackageHandle(std::rc::Rc<std::cell::RefCell<AnyPackage>>);
impl_handle_common!(PackageInterfaceHandle);
impl_handle_common!(CompletePackageInterfaceHandle);
@@ -1552,7 +1550,9 @@ impl PackageInterfaceHandle {
impl PackageHandle {
pub fn from_package(package: Package) -> Self {
- Self(Rc::new(RefCell::new(AnyPackage::Package(package))))
+ Self(std::rc::Rc::new(std::cell::RefCell::new(
+ AnyPackage::Package(package),
+ )))
}
pub fn new(name: String, version: String, pretty_version: String) -> Self {
@@ -1562,7 +1562,9 @@ impl PackageHandle {
impl CompletePackageHandle {
pub fn from_complete_package(package: CompletePackage) -> Self {
- Self(Rc::new(RefCell::new(AnyPackage::CompletePackage(package))))
+ Self(std::rc::Rc::new(std::cell::RefCell::new(
+ AnyPackage::CompletePackage(package),
+ )))
}
pub fn new(name: String, version: String, pretty_version: String) -> Self {
@@ -1572,7 +1574,9 @@ impl CompletePackageHandle {
impl RootPackageHandle {
pub fn from_root_package(package: RootPackage) -> Self {
- Self(Rc::new(RefCell::new(AnyPackage::RootPackage(package))))
+ Self(std::rc::Rc::new(std::cell::RefCell::new(
+ AnyPackage::RootPackage(package),
+ )))
}
pub fn new(name: String, version: String, pretty_version: String) -> Self {
@@ -1589,7 +1593,9 @@ impl RootPackageHandle {
impl AliasPackageHandle {
pub fn from_alias_package(package: AliasPackage) -> Self {
- Self(Rc::new(RefCell::new(AnyPackage::AliasPackage(package))))
+ Self(std::rc::Rc::new(std::cell::RefCell::new(
+ AnyPackage::AliasPackage(package),
+ )))
}
pub fn new(alias_of: PackageHandle, version: String, pretty_version: String) -> Self {
@@ -1636,9 +1642,9 @@ impl AliasPackageHandle {
impl CompleteAliasPackageHandle {
pub fn from_complete_alias_package(package: CompleteAliasPackage) -> Self {
- Self(Rc::new(RefCell::new(AnyPackage::CompleteAliasPackage(
- package,
- ))))
+ Self(std::rc::Rc::new(std::cell::RefCell::new(
+ AnyPackage::CompleteAliasPackage(package),
+ )))
}
pub fn new(alias_of: CompletePackageHandle, version: String, pretty_version: String) -> Self {
@@ -1669,7 +1675,9 @@ impl CompleteAliasPackageHandle {
impl RootAliasPackageHandle {
pub fn from_root_alias_package(package: RootAliasPackage) -> Self {
- Self(Rc::new(RefCell::new(AnyPackage::RootAliasPackage(package))))
+ Self(std::rc::Rc::new(std::cell::RefCell::new(
+ AnyPackage::RootAliasPackage(package),
+ )))
}
pub fn new(alias_of: RootPackageHandle, version: String, pretty_version: String) -> Self {
diff --git a/crates/shirabe/src/package/loader/validating_array_loader.rs b/crates/shirabe/src/package/loader/validating_array_loader.rs
index 3250f011..4d7965f8 100644
--- a/crates/shirabe/src/package/loader/validating_array_loader.rs
+++ b/crates/shirabe/src/package/loader/validating_array_loader.rs
@@ -18,7 +18,6 @@ use shirabe_semver::Intervals;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
use shirabe_spdx_licenses::SpdxLicenses;
-use std::cell::RefCell;
#[derive(Debug)]
pub struct ValidatingArrayLoader {
@@ -26,9 +25,9 @@ pub struct ValidatingArrayLoader {
version_parser: VersionParser,
// RefCell: `load` implements `LoaderInterface`, whose signature takes `&self`, but PHP's
// implementation freely mutates these as scratch state for the duration of a single call.
- errors: RefCell<Vec<String>>,
- warnings: RefCell<Vec<String>>,
- config: RefCell<IndexMap<String, PhpMixed>>,
+ errors: std::cell::RefCell<Vec<String>>,
+ warnings: std::cell::RefCell<Vec<String>>,
+ config: std::cell::RefCell<IndexMap<String, PhpMixed>>,
flags: i64,
}
@@ -55,9 +54,9 @@ impl ValidatingArrayLoader {
Self {
loader,
version_parser,
- errors: RefCell::new(Vec::new()),
- warnings: RefCell::new(Vec::new()),
- config: RefCell::new(IndexMap::new()),
+ errors: std::cell::RefCell::new(Vec::new()),
+ warnings: std::cell::RefCell::new(Vec::new()),
+ config: std::cell::RefCell::new(IndexMap::new()),
flags,
}
}
diff --git a/crates/shirabe/src/package/package.rs b/crates/shirabe/src/package/package.rs
index 6eaf348b..ce22b755 100644
--- a/crates/shirabe/src/package/package.rs
+++ b/crates/shirabe/src/package/package.rs
@@ -12,7 +12,6 @@ use chrono::{DateTime, Utc};
use indexmap::{IndexMap, IndexSet};
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{E_USER_DEPRECATED, LogicException, PhpMixed, strpos, trigger_error};
-use std::rc::Rc;
/// Mirror entry, e.g. `['url' => 'https://...', 'preferred' => true]`.
#[derive(Debug, Clone)]
@@ -709,7 +708,7 @@ impl PackageInterface for Package {
}
fn set_repository(&mut self, repository: RepositoryInterfaceHandle) -> anyhow::Result<()> {
if let Some(existing) = self.repository.as_ref().and_then(|w| w.upgrade())
- && !Rc::ptr_eq(&existing, repository.as_rc())
+ && !std::rc::Rc::ptr_eq(&existing, repository.as_rc())
{
return Err(LogicException {
message: "A package can only be added to one repository".to_string(),
diff --git a/crates/shirabe/src/plugin/plugin_interface.rs b/crates/shirabe/src/plugin/plugin_interface.rs
index 486dbeac..5a92a87a 100644
--- a/crates/shirabe/src/plugin/plugin_interface.rs
+++ b/crates/shirabe/src/plugin/plugin_interface.rs
@@ -3,17 +3,27 @@
use crate::composer::ComposerHandle;
use crate::io::IOInterface;
use crate::plugin::Capable;
-use std::cell::RefCell;
-use std::rc::Rc;
pub const PLUGIN_API_VERSION: &str = "2.9.0";
pub trait PluginInterface: std::fmt::Debug {
- fn activate(&mut self, composer: &ComposerHandle, io: Rc<RefCell<dyn IOInterface>>);
+ fn activate(
+ &mut self,
+ composer: &ComposerHandle,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ );
- fn deactivate(&mut self, composer: &ComposerHandle, io: Rc<RefCell<dyn IOInterface>>);
+ fn deactivate(
+ &mut self,
+ composer: &ComposerHandle,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ );
- fn uninstall(&mut self, composer: &ComposerHandle, io: Rc<RefCell<dyn IOInterface>>);
+ fn uninstall(
+ &mut self,
+ composer: &ComposerHandle,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ );
// TODO(plugin): PHP-side `instanceof` checks for EventSubscriberInterface / Capable.
// EventSubscriberInterface is not dyn-compatible (its only method is associated, not
diff --git a/crates/shirabe/src/repository/array_repository.rs b/crates/shirabe/src/repository/array_repository.rs
index dc31baad..6f5e4194 100644
--- a/crates/shirabe/src/repository/array_repository.rs
+++ b/crates/shirabe/src/repository/array_repository.rs
@@ -16,20 +16,19 @@ use shirabe_external_packages::composer::pcre::Preg;
use shirabe_php_shim::{implode, preg_quote, strtolower};
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-use std::cell::RefCell;
use std::rc::Weak;
/// A repository implementation that simply stores packages in an array
#[derive(Debug)]
pub struct ArrayRepository {
- pub(crate) packages: RefCell<Option<Vec<BasePackageHandle>>>,
+ pub(crate) packages: std::cell::RefCell<Option<Vec<BasePackageHandle>>>,
/// @var ?array<BasePackage> indexed by package unique name and used to cache hasPackage calls
- pub(crate) package_map: RefCell<Option<IndexMap<String, BasePackageHandle>>>,
+ pub(crate) package_map: std::cell::RefCell<Option<IndexMap<String, BasePackageHandle>>>,
/// Weak reference to the outermost repository handle wrapping this `ArrayRepository`,
/// injected via `set_self_handle`. Used to wire package -> repository back-references.
- self_weak: RefCell<Option<RepositoryInterfaceWeakHandle>>,
+ self_weak: std::cell::RefCell<Option<RepositoryInterfaceWeakHandle>>,
}
impl ArrayRepository {
@@ -120,9 +119,9 @@ impl ArrayRepository {
/// @param array<PackageInterface> $packages
pub fn new(packages: Vec<PackageInterfaceHandle>) -> anyhow::Result<Self> {
let this = Self {
- packages: RefCell::new(None),
- package_map: RefCell::new(None),
- self_weak: RefCell::new(None),
+ packages: std::cell::RefCell::new(None),
+ package_map: std::cell::RefCell::new(None),
+ self_weak: std::cell::RefCell::new(None),
};
for package in packages {
this.add_package(package)?;
diff --git a/crates/shirabe/src/repository/handle.rs b/crates/shirabe/src/repository/handle.rs
index 64cb5b73..f093f66b 100644
--- a/crates/shirabe/src/repository/handle.rs
+++ b/crates/shirabe/src/repository/handle.rs
@@ -8,35 +8,36 @@ use crate::repository::{
};
use indexmap::IndexMap;
use shirabe_semver::constraint::AnyConstraint;
-use std::cell::{Ref, RefCell, RefMut};
-use std::rc::{Rc, Weak};
+use std::cell::{Ref, RefMut};
+use std::rc::Weak;
/// Shared reference to a repository. Corresponds to PHP `RepositoryInterface`.
#[derive(Debug, Clone)]
-pub struct RepositoryInterfaceHandle(Rc<RefCell<dyn RepositoryInterface>>);
+pub struct RepositoryInterfaceHandle(std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>>);
/// Weak back-reference held by packages to the repository that owns them.
-pub type RepositoryInterfaceWeakHandle = Weak<RefCell<dyn RepositoryInterface>>;
+pub type RepositoryInterfaceWeakHandle = Weak<std::cell::RefCell<dyn RepositoryInterface>>;
impl RepositoryInterfaceHandle {
/// Wraps a concrete repository in a shared handle and injects its own weak reference so that
/// `add_package` can wire package -> repository back-references (PHP `setRepository($this)`).
pub fn new<T: RepositoryInterface + 'static>(repository: T) -> Self {
- let rc: Rc<RefCell<dyn RepositoryInterface>> = Rc::new(RefCell::new(repository));
- rc.borrow().set_self_handle(Rc::downgrade(&rc));
+ let rc: std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(repository));
+ rc.borrow().set_self_handle(std::rc::Rc::downgrade(&rc));
Self(rc)
}
- pub fn from_rc(rc: Rc<RefCell<dyn RepositoryInterface>>) -> Self {
+ pub fn from_rc(rc: std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>>) -> Self {
Self(rc)
}
- pub fn as_rc(&self) -> &Rc<RefCell<dyn RepositoryInterface>> {
+ pub fn as_rc(&self) -> &std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>> {
&self.0
}
pub fn downgrade(&self) -> RepositoryInterfaceWeakHandle {
- Rc::downgrade(&self.0)
+ std::rc::Rc::downgrade(&self.0)
}
pub fn borrow(&self) -> Ref<'_, dyn RepositoryInterface> {
@@ -49,12 +50,12 @@ impl RepositoryInterfaceHandle {
/// PHP `===` (reference identity).
pub fn ptr_eq(&self, other: &Self) -> bool {
- Rc::ptr_eq(&self.0, &other.0)
+ std::rc::Rc::ptr_eq(&self.0, &other.0)
}
/// Stable identity usable as a map key (PHP `spl_object_hash`).
pub fn ptr_id(&self) -> usize {
- Rc::as_ptr(&self.0) as *const () as usize
+ std::rc::Rc::as_ptr(&self.0) as *const () as usize
}
/// PHP `instanceof T` for a concrete repository type. Keeps the `RefCell` borrow internal.
@@ -63,13 +64,15 @@ impl RepositoryInterfaceHandle {
}
/// Downcasts the shared handle to a concrete repository type, preserving shared ownership.
- pub fn downcast_rc<T: RepositoryInterface + 'static>(&self) -> Option<Rc<RefCell<T>>> {
+ pub fn downcast_rc<T: RepositoryInterface + 'static>(
+ &self,
+ ) -> Option<std::rc::Rc<std::cell::RefCell<T>>> {
if self.0.borrow().as_any().is::<T>() {
let rc = self.0.clone();
- let ptr = Rc::into_raw(rc) as *const RefCell<T>;
+ let ptr = std::rc::Rc::into_raw(rc) as *const std::cell::RefCell<T>;
// SAFETY: is::<T>() proved the value is `T`, and handles are always allocated as
// `Rc::new(RefCell::new(concrete))`, so the layout matches `RcBox<RefCell<T>>`.
- Some(unsafe { Rc::from_raw(ptr) })
+ Some(unsafe { std::rc::Rc::from_raw(ptr) })
} else {
None
}
@@ -191,7 +194,7 @@ impl RepositoryInterfaceHandle {
impl PartialEq for RepositoryInterfaceHandle {
fn eq(&self, other: &Self) -> bool {
- Rc::ptr_eq(&self.0, &other.0)
+ std::rc::Rc::ptr_eq(&self.0, &other.0)
}
}
@@ -205,21 +208,22 @@ impl std::hash::Hash for RepositoryInterfaceHandle {
/// Typed shared handle over `LockArrayRepository`.
#[derive(Debug, Clone)]
-pub struct LockArrayRepositoryHandle(Rc<RefCell<LockArrayRepository>>);
+pub struct LockArrayRepositoryHandle(std::rc::Rc<std::cell::RefCell<LockArrayRepository>>);
impl LockArrayRepositoryHandle {
pub fn new(repository: LockArrayRepository) -> Self {
- let rc: Rc<RefCell<LockArrayRepository>> = Rc::new(RefCell::new(repository));
- let rc_dyn: Rc<RefCell<dyn RepositoryInterface>> = rc.clone();
- rc.borrow().set_self_handle(Rc::downgrade(&rc_dyn));
+ let rc: std::rc::Rc<std::cell::RefCell<LockArrayRepository>> =
+ std::rc::Rc::new(std::cell::RefCell::new(repository));
+ let rc_dyn: std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>> = rc.clone();
+ rc.borrow().set_self_handle(std::rc::Rc::downgrade(&rc_dyn));
Self(rc)
}
- pub fn from_rc(rc: Rc<RefCell<LockArrayRepository>>) -> Self {
+ pub fn from_rc(rc: std::rc::Rc<std::cell::RefCell<LockArrayRepository>>) -> Self {
Self(rc)
}
- pub fn as_rc(&self) -> &Rc<RefCell<LockArrayRepository>> {
+ pub fn as_rc(&self) -> &std::rc::Rc<std::cell::RefCell<LockArrayRepository>> {
&self.0
}
@@ -236,24 +240,24 @@ impl LockArrayRepositoryHandle {
}
pub fn ptr_eq(&self, other: &Self) -> bool {
- Rc::ptr_eq(&self.0, &other.0)
+ std::rc::Rc::ptr_eq(&self.0, &other.0)
}
pub fn ptr_id(&self) -> usize {
- Rc::as_ptr(&self.0) as *const () as usize
+ std::rc::Rc::as_ptr(&self.0) as *const () as usize
}
}
impl From<LockArrayRepositoryHandle> for RepositoryInterfaceHandle {
fn from(h: LockArrayRepositoryHandle) -> Self {
- let rc: Rc<RefCell<dyn RepositoryInterface>> = h.0;
+ let rc: std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>> = h.0;
RepositoryInterfaceHandle::from_rc(rc)
}
}
impl PartialEq for LockArrayRepositoryHandle {
fn eq(&self, other: &Self) -> bool {
- Rc::ptr_eq(&self.0, &other.0)
+ std::rc::Rc::ptr_eq(&self.0, &other.0)
}
}
@@ -267,21 +271,22 @@ impl std::hash::Hash for LockArrayRepositoryHandle {
/// Typed shared handle over `PlatformRepository`.
#[derive(Debug, Clone)]
-pub struct PlatformRepositoryHandle(Rc<RefCell<PlatformRepository>>);
+pub struct PlatformRepositoryHandle(std::rc::Rc<std::cell::RefCell<PlatformRepository>>);
impl PlatformRepositoryHandle {
pub fn new(repository: PlatformRepository) -> Self {
- let rc: Rc<RefCell<PlatformRepository>> = Rc::new(RefCell::new(repository));
- let rc_dyn: Rc<RefCell<dyn RepositoryInterface>> = rc.clone();
- rc.borrow().set_self_handle(Rc::downgrade(&rc_dyn));
+ let rc: std::rc::Rc<std::cell::RefCell<PlatformRepository>> =
+ std::rc::Rc::new(std::cell::RefCell::new(repository));
+ let rc_dyn: std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>> = rc.clone();
+ rc.borrow().set_self_handle(std::rc::Rc::downgrade(&rc_dyn));
Self(rc)
}
- pub fn from_rc(rc: Rc<RefCell<PlatformRepository>>) -> Self {
+ pub fn from_rc(rc: std::rc::Rc<std::cell::RefCell<PlatformRepository>>) -> Self {
Self(rc)
}
- pub fn as_rc(&self) -> &Rc<RefCell<PlatformRepository>> {
+ pub fn as_rc(&self) -> &std::rc::Rc<std::cell::RefCell<PlatformRepository>> {
&self.0
}
@@ -294,24 +299,24 @@ impl PlatformRepositoryHandle {
}
pub fn ptr_eq(&self, other: &Self) -> bool {
- Rc::ptr_eq(&self.0, &other.0)
+ std::rc::Rc::ptr_eq(&self.0, &other.0)
}
pub fn ptr_id(&self) -> usize {
- Rc::as_ptr(&self.0) as *const () as usize
+ std::rc::Rc::as_ptr(&self.0) as *const () as usize
}
}
impl From<PlatformRepositoryHandle> for RepositoryInterfaceHandle {
fn from(h: PlatformRepositoryHandle) -> Self {
- let rc: Rc<RefCell<dyn RepositoryInterface>> = h.0;
+ let rc: std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>> = h.0;
RepositoryInterfaceHandle::from_rc(rc)
}
}
impl PartialEq for PlatformRepositoryHandle {
fn eq(&self, other: &Self) -> bool {
- Rc::ptr_eq(&self.0, &other.0)
+ std::rc::Rc::ptr_eq(&self.0, &other.0)
}
}
diff --git a/crates/shirabe/src/repository/vcs/vcs_driver_interface.rs b/crates/shirabe/src/repository/vcs/vcs_driver_interface.rs
index fb10d0f2..628f78b7 100644
--- a/crates/shirabe/src/repository/vcs/vcs_driver_interface.rs
+++ b/crates/shirabe/src/repository/vcs/vcs_driver_interface.rs
@@ -5,8 +5,6 @@ use crate::io::IOInterface;
use chrono::{DateTime, FixedOffset};
use indexmap::IndexMap;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
pub trait VcsDriverInterface: std::fmt::Debug {
fn initialize(&mut self) -> anyhow::Result<()>;
@@ -40,8 +38,8 @@ pub trait VcsDriverInterface: std::fmt::Debug {
fn cleanup(&mut self) -> anyhow::Result<()>;
fn supports(
- io: Rc<RefCell<dyn IOInterface>>,
- config: Rc<RefCell<Config>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
url: &str,
deep: bool,
) -> anyhow::Result<bool>
diff --git a/crates/shirabe/src/util/error_handler.rs b/crates/shirabe/src/util/error_handler.rs
index 45ad28a8..7a9cf9c2 100644
--- a/crates/shirabe/src/util/error_handler.rs
+++ b/crates/shirabe/src/util/error_handler.rs
@@ -7,14 +7,13 @@ use shirabe_php_shim::{
STDERR, debug_backtrace, error_reporting, filter_var_boolean, fwrite, ini_get,
set_error_handler,
};
-use std::cell::{Cell, RefCell};
-use std::rc::Rc;
+use std::cell::Cell;
// PHP keeps `$io` / `$hasShownDeprecationNotice` as process-global statics. Composer runs
// single-threaded, so thread-locals on the main thread reproduce that faithfully while letting
// us hold the same shared (`Rc<RefCell<dyn IOInterface>>`) IO instance the application uses.
thread_local! {
- static IO: RefCell<Option<Rc<RefCell<dyn IOInterface>>>> = const { RefCell::new(None) };
+ static IO: std::cell::RefCell<Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>> = const { std::cell::RefCell::new(None) };
static HAS_SHOWN_DEPRECATION_NOTICE: Cell<i64> = const { Cell::new(0) };
}
@@ -88,7 +87,7 @@ impl ErrorHandler {
Ok(true)
}
- pub fn register(io: Option<Rc<RefCell<dyn IOInterface>>>) {
+ pub fn register(io: Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>) {
set_error_handler(|level, message, file, line| {
Self::handle(level, message.to_string(), file.to_string(), line).unwrap_or(true)
});
diff --git a/crates/shirabe/tests/advisory/auditor_test.rs b/crates/shirabe/tests/advisory/auditor_test.rs
index fa99825d..dd904632 100644
--- a/crates/shirabe/tests/advisory/auditor_test.rs
+++ b/crates/shirabe/tests/advisory/auditor_test.rs
@@ -29,8 +29,6 @@ use shirabe_php_shim::date_create;
use shirabe_semver::VersionParser;
use shirabe_semver::constraint::AnyConstraint;
use shirabe_semver::constraint::SimpleConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
fn constraint(operator: &str, version: &str) -> shirabe_semver::constraint::AnyConstraint {
SimpleConstraint::new(operator.to_string(), version.to_string(), None).into()
@@ -594,9 +592,10 @@ Found 2 abandoned packages:
for case in cases {
let repo_set = get_repo_set();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
+ ));
let auditor = Auditor;
let result = auditor
.audit(
@@ -824,7 +823,7 @@ fn test_audit_with_ignore() {
let repo_set = get_repo_set();
let (io_mock, _io_guard) = get_io_mock(io_interface::NORMAL).unwrap();
let auditor = Auditor;
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let result = auditor
.audit(
&io_dyn,
@@ -924,9 +923,10 @@ fn test_audit_with_ignore_unreachable() {
// Without the ignoreUnreachable flag the TransportException propagates.
{
let repo_set = make_repo_set();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
+ ));
let err = auditor
.audit(
&io,
@@ -947,9 +947,10 @@ fn test_audit_with_ignore_unreachable() {
// With the ignoreUnreachable flag the advisories from reachable repos are reported.
{
let repo_set = make_repo_set();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
+ ));
let result = auditor
.audit(
&io,
@@ -983,9 +984,10 @@ fn test_audit_with_ignore_unreachable() {
// With JSON format the unreachable repositories and advisories are both included.
{
let repo_set = make_repo_set();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
+ ));
let result = auditor
.audit(
&io,
@@ -1082,7 +1084,7 @@ fn test_audit_with_ignore_severity() {
let repo_set = get_repo_set();
let (io_mock, _io_guard) = get_io_mock(io_interface::NORMAL).unwrap();
let auditor = Auditor;
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let result = auditor
.audit(
&io_dyn,
diff --git a/crates/shirabe/tests/all_functional_test.rs b/crates/shirabe/tests/all_functional_test.rs
index c6eb683b..b1717d08 100644
--- a/crates/shirabe/tests/all_functional_test.rs
+++ b/crates/shirabe/tests/all_functional_test.rs
@@ -10,7 +10,6 @@ use serial_test::serial;
use shirabe::util::filesystem::Filesystem;
use shirabe_external_packages::composer::pcre::preg::Preg;
use shirabe_php_shim::{CaptureKey, PREG_SPLIT_DELIM_CAPTURE, PhpMixed, intval};
-use std::cell::RefCell;
use std::path::{Path, PathBuf};
/// ref: AllFunctionalTest's `$oldcwd` / `$testDir` instance state plus its `setUp`/`tearDown`.
@@ -19,7 +18,7 @@ use std::path::{Path, PathBuf};
/// cwd and removes the unique temp dir created by `testIntegration`. Modelled as an RAII guard.
struct TearDown {
old_cwd: PathBuf,
- test_dir: RefCell<Option<PathBuf>>,
+ test_dir: std::cell::RefCell<Option<PathBuf>>,
}
impl Drop for TearDown {
@@ -42,7 +41,7 @@ fn set_up() -> TearDown {
std::env::set_current_dir(fixtures_dir()).unwrap();
TearDown {
old_cwd,
- test_dir: RefCell::new(None),
+ test_dir: std::cell::RefCell::new(None),
}
}
diff --git a/crates/shirabe/tests/application_test.rs b/crates/shirabe/tests/application_test.rs
index 7ee58e49..df5f6e4f 100644
--- a/crates/shirabe/tests/application_test.rs
+++ b/crates/shirabe/tests/application_test.rs
@@ -21,8 +21,6 @@ use shirabe_external_packages::symfony::console::input::input_interface::InputIn
use shirabe_external_packages::symfony::console::output::buffered_output::BufferedOutput;
use shirabe_external_packages::symfony::console::output::output_interface::OutputInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
fn set_up() {
Platform::put_env("COMPOSER_DISABLE_XDEBUG_WARN", "1");
@@ -61,18 +59,22 @@ fn test_dev_warning_suppressed_for_self_update() {
}
let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap();
- let command: Rc<RefCell<dyn Command>> = Rc::new(RefCell::new(SelfUpdateCommand::new()));
+ let command: std::rc::Rc<std::cell::RefCell<dyn Command>> =
+ std::rc::Rc::new(std::cell::RefCell::new(SelfUpdateCommand::new()));
application.add(command).unwrap();
- let output = Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(
- ArrayInput::new(
- vec![(PhpMixed::from("command"), PhpMixed::from("self-update"))],
- None,
- )
- .unwrap(),
- ));
- let output_trait: Rc<RefCell<dyn OutputInterface>> = output.clone();
+ let output = std::rc::Rc::new(std::cell::RefCell::new(BufferedOutput::new(
+ None, false, None,
+ )));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ ArrayInput::new(
+ vec![(PhpMixed::from("command"), PhpMixed::from("self-update"))],
+ None,
+ )
+ .unwrap(),
+ ));
+ let output_trait: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = output.clone();
application.do_run(input, output_trait).unwrap();
assert_eq!(
@@ -88,29 +90,34 @@ fn test_process_isolation_works_multiple_times() {
set_up();
let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap();
- let command: Rc<RefCell<dyn Command>> = Rc::new(RefCell::new(AboutCommand::new()));
+ let command: std::rc::Rc<std::cell::RefCell<dyn Command>> =
+ std::rc::Rc::new(std::cell::RefCell::new(AboutCommand::new()));
application.add(command).unwrap();
- let input1: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(
- ArrayInput::new(
- vec![(PhpMixed::from("command"), PhpMixed::from("about"))],
- None,
- )
- .unwrap(),
- ));
- let output1: Rc<RefCell<dyn OutputInterface>> =
- Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
+ let input1: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ ArrayInput::new(
+ vec![(PhpMixed::from("command"), PhpMixed::from("about"))],
+ None,
+ )
+ .unwrap(),
+ ));
+ let output1: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(BufferedOutput::new(None, false, None)),
+ );
assert_eq!(0, application.do_run(input1, output1).unwrap());
- let input2: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(
- ArrayInput::new(
- vec![(PhpMixed::from("command"), PhpMixed::from("about"))],
- None,
- )
- .unwrap(),
- ));
- let output2: Rc<RefCell<dyn OutputInterface>> =
- Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
+ let input2: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ ArrayInput::new(
+ vec![(PhpMixed::from("command"), PhpMixed::from("about"))],
+ None,
+ )
+ .unwrap(),
+ ));
+ let output2: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(BufferedOutput::new(None, false, None)),
+ );
assert_eq!(0, application.do_run(input2, output2).unwrap());
}
@@ -143,18 +150,20 @@ fn test_no_plugins_disables_plugins_when_script_commands_exist() {
// Run list command with --no-plugins, this triggers script command registration which previously
// created a Composer instance with plugins enabled regardless of the --no-plugins flag
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(
- ArrayInput::new(
- vec![
- (PhpMixed::from("command"), PhpMixed::from("list")),
- (PhpMixed::from("--no-plugins"), PhpMixed::from(true)),
- ],
- None,
- )
- .unwrap(),
- ));
- let output: Rc<RefCell<dyn OutputInterface>> =
- Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ ArrayInput::new(
+ vec![
+ (PhpMixed::from("command"), PhpMixed::from("list")),
+ (PhpMixed::from("--no-plugins"), PhpMixed::from(true)),
+ ],
+ None,
+ )
+ .unwrap(),
+ ));
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(BufferedOutput::new(None, false, None)),
+ );
application.do_run(input, output).unwrap();
let composer = application.__get_composer(false, None, None).unwrap();
@@ -207,15 +216,18 @@ fn test_script_command_takes_priority_over_abbreviated_builtin_command() {
let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap();
application.set_catch_exceptions(false);
- let app_output = Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(
- ArrayInput::new(
- vec![(PhpMixed::from("command"), PhpMixed::from("check"))],
- None,
- )
- .unwrap(),
- ));
- let output_trait: Rc<RefCell<dyn OutputInterface>> = app_output.clone();
+ let app_output = std::rc::Rc::new(std::cell::RefCell::new(BufferedOutput::new(
+ None, false, None,
+ )));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ ArrayInput::new(
+ vec![(PhpMixed::from("command"), PhpMixed::from("check"))],
+ None,
+ )
+ .unwrap(),
+ ));
+ let output_trait: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = app_output.clone();
let exit_code = application.do_run(input, output_trait).unwrap();
assert_eq!(0, exit_code, "Script command should have run successfully");
diff --git a/crates/shirabe/tests/autoload/autoload_generator_test.rs b/crates/shirabe/tests/autoload/autoload_generator_test.rs
index a79bba0f..d7159c27 100644
--- a/crates/shirabe/tests/autoload/autoload_generator_test.rs
+++ b/crates/shirabe/tests/autoload/autoload_generator_test.rs
@@ -21,8 +21,6 @@ use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
use shirabe_semver::constraint::{AnyConstraint, MatchAllConstraint, SimpleConstraint};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
/// The mock `InstallationManager::getInstallPath` used throughout the test: metapackages return
@@ -128,9 +126,9 @@ struct SetUp {
vendor_dir: String,
repository: InstalledArrayRepository,
im: InstallationManager,
- io: Rc<RefCell<BufferIO>>,
+ io: std::rc::Rc<std::cell::RefCell<BufferIO>>,
generator: AutoloadGenerator,
- event_dispatcher: Rc<RefCell<EventDispatcher>>,
+ event_dispatcher: std::rc::Rc<std::cell::RefCell<EventDispatcher>>,
}
impl Drop for SetUp {
@@ -148,14 +146,14 @@ fn null_path(s: &str) -> String {
/// exercised here, so a mock HttpDownloader (no real curl backend) stands in for the loop.
fn make_installation_manager(
vendor_dir: &str,
- io: Rc<RefCell<dyn IOInterface>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
) -> InstallationManager {
- let config_for_downloader = Rc::new(RefCell::new(Config::new(false, None)));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(
+ let config_for_downloader = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::__new_mock(
io.clone(),
config_for_downloader,
)));
- let loop_ = Rc::new(RefCell::new(Loop::new(http_downloader, None)));
+ let loop_ = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(http_downloader, None)));
let mut im = InstallationManager::new(loop_, io, None);
im.add_installer(Box::new(InstallPathStubInstaller {
@@ -173,20 +171,21 @@ fn set_up() -> SetUp {
let prev_cwd = std::env::current_dir().unwrap();
std::env::set_current_dir(&working_dir).unwrap();
- let io = Rc::new(RefCell::new(
+ let io = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
));
- let dispatcher_io: Rc<RefCell<dyn IOInterface>> = io.clone();
+ let dispatcher_io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io.clone();
let im = make_installation_manager(&vendor_dir, dispatcher_io.clone());
let repository = InstalledArrayRepository::new().unwrap();
// EventDispatcher constructor is disabled in PHP and dispatch is never called when run-scripts
// is off (the default), so a real dispatcher over an empty Composer is a faithful no-op stand-in.
- let composer =
- ComposerHandle::from_rc_unchecked(Rc::new(RefCell::new(PartialOrFullComposer::new_full())));
- let event_dispatcher = Rc::new(RefCell::new(EventDispatcher::new(
+ let composer = ComposerHandle::from_rc_unchecked(std::rc::Rc::new(std::cell::RefCell::new(
+ PartialOrFullComposer::new_full(),
+ )));
+ let event_dispatcher = std::rc::Rc::new(std::cell::RefCell::new(EventDispatcher::new(
composer.upcast().downgrade(),
dispatcher_io.clone(),
None,
diff --git a/crates/shirabe/tests/cache_test.rs b/crates/shirabe/tests/cache_test.rs
index b9644dc9..c7c665f8 100644
--- a/crates/shirabe/tests/cache_test.rs
+++ b/crates/shirabe/tests/cache_test.rs
@@ -4,9 +4,7 @@ use shirabe::cache::{Cache, CacheMock, GcFinderMock};
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::util::filesystem::Filesystem;
-use std::cell::RefCell;
use std::fs;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -28,7 +26,8 @@ fn set_up() -> SetUp {
// PHP mocks Cache::getFinder and keeps the real Filesystem; here the CacheMock finder seam plays
// that role and the Cache otherwise operates on the real temp directory.
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let cache = Cache::new(io, root.path().to_str().unwrap(), None, None, false);
SetUp { root, files, cache }
@@ -113,7 +112,8 @@ fn test_remove_files_when_cache_is_too_large() {
#[test]
fn test_clear_cache() {
let root = TempDir::new().unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut cache = Cache::new(
io,
root.path().to_str().unwrap(),
diff --git a/crates/shirabe/tests/command/archive_command_test.rs b/crates/shirabe/tests/command/archive_command_test.rs
index 991f615a..322894db 100644
--- a/crates/shirabe/tests/command/archive_command_test.rs
+++ b/crates/shirabe/tests/command/archive_command_test.rs
@@ -22,8 +22,6 @@ use shirabe_external_packages::symfony::console::output::OutputInterface;
use shirabe_external_packages::symfony::console::output::buffered_output::BufferedOutput;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
// PHP mocks `Composer\Package\Archiver\ArchiveManager` with
// getMockBuilder(...)->disableOriginalConstructor().
@@ -108,17 +106,21 @@ fn root_package(name: &str, version: &str) -> RootPackageHandle {
}
fn full_composer(composer: Composer) -> PartialComposerHandle {
- PartialComposerHandle::from_rc(Rc::new(RefCell::new(PartialOrFullComposer::Full(composer))))
+ PartialComposerHandle::from_rc(std::rc::Rc::new(std::cell::RefCell::new(
+ PartialOrFullComposer::Full(composer),
+ )))
}
#[test]
fn test_uses_config_from_composer_object() {
- let input: Rc<RefCell<dyn InputInterface>> =
- Rc::new(RefCell::new(ArrayInput::new(vec![], None).unwrap()));
- let output: Rc<RefCell<dyn OutputInterface>> =
- Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(ArrayInput::new(vec![], None).unwrap()),
+ );
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(BufferedOutput::new(None, false, None)),
+ );
- let config: Rc<RefCell<Config>> = ConfigStubBuilder::new()
+ let config: std::rc::Rc<std::cell::RefCell<Config>> = ConfigStubBuilder::new()
.with("archive-format", PhpMixed::from("zip"))
.build_shared();
@@ -144,8 +146,10 @@ fn test_uses_config_from_composer_object() {
let mut composer = Composer::new();
composer.set_config(config);
- composer.set_archive_manager(Rc::new(RefCell::new(manager)));
- composer.set_event_dispatcher(Rc::new(RefCell::new(noop_event_dispatcher())));
+ composer.set_archive_manager(std::rc::Rc::new(std::cell::RefCell::new(manager)));
+ composer.set_event_dispatcher(std::rc::Rc::new(std::cell::RefCell::new(
+ noop_event_dispatcher(),
+ )));
composer.set_package(package.into());
let composer = full_composer(composer);
@@ -158,10 +162,12 @@ fn test_uses_config_from_composer_object() {
#[test]
fn test_uses_config_from_factory_when_composer_is_not_defined() {
- let input: Rc<RefCell<dyn InputInterface>> =
- Rc::new(RefCell::new(ArrayInput::new(vec![], None).unwrap()));
- let output: Rc<RefCell<dyn OutputInterface>> =
- Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(ArrayInput::new(vec![], None).unwrap()),
+ );
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(BufferedOutput::new(None, false, None)),
+ );
// tryComposer() returns null (no Composer set), so execute() builds the Config via the Factory
// and `archive` is stubbed (PHPUnit overrides initialize/tryComposer/archive).
@@ -188,17 +194,19 @@ fn test_uses_config_from_factory_when_composer_is_not_defined() {
#[test]
fn test_uses_config_from_composer_object_with_package_name() {
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(
- ArrayInput::new(
- vec![(PhpMixed::from("package"), PhpMixed::from("foo/bar"))],
- None,
- )
- .unwrap(),
- ));
- let output: Rc<RefCell<dyn OutputInterface>> =
- Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ ArrayInput::new(
+ vec![(PhpMixed::from("package"), PhpMixed::from("foo/bar"))],
+ None,
+ )
+ .unwrap(),
+ ));
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(BufferedOutput::new(None, false, None)),
+ );
- let config: Rc<RefCell<Config>> = ConfigStubBuilder::new()
+ let config: std::rc::Rc<std::cell::RefCell<Config>> = ConfigStubBuilder::new()
.with("archive-format", PhpMixed::from("zip"))
.build_shared();
@@ -241,10 +249,14 @@ fn test_uses_config_from_composer_object_with_package_name() {
let mut composer = Composer::new();
composer.set_config(config);
- composer.set_archive_manager(Rc::new(RefCell::new(manager)));
- composer.set_event_dispatcher(Rc::new(RefCell::new(noop_event_dispatcher())));
+ composer.set_archive_manager(std::rc::Rc::new(std::cell::RefCell::new(manager)));
+ composer.set_event_dispatcher(std::rc::Rc::new(std::cell::RefCell::new(
+ noop_event_dispatcher(),
+ )));
composer.set_package(package.into());
- composer.set_repository_manager(Rc::new(RefCell::new(repository_manager)));
+ composer.set_repository_manager(std::rc::Rc::new(std::cell::RefCell::new(
+ repository_manager,
+ )));
let composer = full_composer(composer);
let command = ArchiveCommand::new();
diff --git a/crates/shirabe/tests/common/config_stub.rs b/crates/shirabe/tests/common/config_stub.rs
index bf81462a..656dea60 100644
--- a/crates/shirabe/tests/common/config_stub.rs
+++ b/crates/shirabe/tests/common/config_stub.rs
@@ -11,8 +11,6 @@
use indexmap::IndexMap;
use shirabe::config::Config;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
pub struct ConfigStubBuilder {
use_environment: bool,
@@ -65,8 +63,8 @@ impl ConfigStubBuilder {
config
}
- pub fn build_shared(self) -> Rc<RefCell<Config>> {
- Rc::new(RefCell::new(self.build()))
+ pub fn build_shared(self) -> std::rc::Rc<std::cell::RefCell<Config>> {
+ std::rc::Rc::new(std::cell::RefCell::new(self.build()))
}
}
diff --git a/crates/shirabe/tests/common/http_downloader_mock.rs b/crates/shirabe/tests/common/http_downloader_mock.rs
index 85d3ec81..59519ca4 100644
--- a/crates/shirabe/tests/common/http_downloader_mock.rs
+++ b/crates/shirabe/tests/common/http_downloader_mock.rs
@@ -9,8 +9,6 @@ use shirabe::util::http_downloader::{
HttpDownloader, HttpDownloaderMockExpectation, HttpDownloaderMockHandler,
};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
// A single HTTP request expectation as written in the PHP tests: a `url` plus an
// optional response (`status`/`body`/`headers`). `options` of `None` matches any
@@ -41,7 +39,7 @@ pub fn expect_full(
}
}
-pub struct HttpDownloaderMockGuard(Rc<RefCell<HttpDownloader>>);
+pub struct HttpDownloaderMockGuard(std::rc::Rc<std::cell::RefCell<HttpDownloader>>);
impl Drop for HttpDownloaderMockGuard {
fn drop(&mut self) {
@@ -60,10 +58,16 @@ pub fn get_http_downloader_mock(
expectations: Vec<HttpDownloaderMockExpectation>,
strict: bool,
default_handler: HttpDownloaderMockHandler,
-) -> (Rc<RefCell<HttpDownloader>>, HttpDownloaderMockGuard) {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- let downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(io, config)));
+) -> (
+ std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
+ HttpDownloaderMockGuard,
+) {
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::__new_mock(
+ io, config,
+ )));
downloader
.borrow_mut()
.__expects(expectations, strict, default_handler);
diff --git a/crates/shirabe/tests/common/io_mock.rs b/crates/shirabe/tests/common/io_mock.rs
index 7b932a87..e54c45b9 100644
--- a/crates/shirabe/tests/common/io_mock.rs
+++ b/crates/shirabe/tests/common/io_mock.rs
@@ -8,9 +8,7 @@ use shirabe::util::platform::Platform;
use shirabe_external_packages::composer::pcre::Preg;
use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::{PHP_EOL, PhpMixed, preg_quote};
-use std::cell::RefCell;
use std::collections::VecDeque;
-use std::rc::Rc;
// A single entry of the IO expectation list. PHP models these as associative
// arrays (`{text, regex?}` / `{ask, reply}` / `{auth: [repo, user, pass]}`); the
@@ -344,7 +342,7 @@ fn trim_eol(question: &str) -> &str {
question.trim_end_matches(['\r', '\n'])
}
-pub struct IOMockGuard(Rc<RefCell<IOMock>>);
+pub struct IOMockGuard(std::rc::Rc<std::cell::RefCell<IOMock>>);
impl Drop for IOMockGuard {
fn drop(&mut self) {
@@ -358,7 +356,9 @@ impl Drop for IOMockGuard {
// For testing only. Mirrors TestCase::getIOMock: returns a shared IOMock handle
// plus a guard that runs assert_complete when it drops at the end of the test scope.
-pub fn get_io_mock(verbosity: i64) -> anyhow::Result<(Rc<RefCell<IOMock>>, IOMockGuard)> {
- let mock = Rc::new(RefCell::new(IOMock::new(verbosity)?));
+pub fn get_io_mock(
+ verbosity: i64,
+) -> anyhow::Result<(std::rc::Rc<std::cell::RefCell<IOMock>>, IOMockGuard)> {
+ let mock = std::rc::Rc::new(std::cell::RefCell::new(IOMock::new(verbosity)?));
Ok((mock.clone(), IOMockGuard(mock)))
}
diff --git a/crates/shirabe/tests/common/process_executor_mock.rs b/crates/shirabe/tests/common/process_executor_mock.rs
index 698d8d26..33d9dfba 100644
--- a/crates/shirabe/tests/common/process_executor_mock.rs
+++ b/crates/shirabe/tests/common/process_executor_mock.rs
@@ -2,8 +2,6 @@
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
// A command expectation as written in the PHP tests: either a bare command
// (`'git command'` / `['git', '--version']`) or the full
@@ -72,7 +70,7 @@ impl<const N: usize> IntoMockCmd for [&str; N] {
}
}
-pub struct ProcessExecutorMockGuard(Rc<RefCell<ProcessExecutor>>);
+pub struct ProcessExecutorMockGuard(std::rc::Rc<std::cell::RefCell<ProcessExecutor>>);
impl Drop for ProcessExecutorMockGuard {
fn drop(&mut self) {
@@ -91,8 +89,11 @@ pub fn get_process_executor_mock(
expectations: Vec<MockExpectation>,
strict: bool,
default_handler: MockHandler,
-) -> (Rc<RefCell<ProcessExecutor>>, ProcessExecutorMockGuard) {
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+) -> (
+ std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
+ ProcessExecutorMockGuard,
+) {
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
process
.borrow_mut()
.__expects(expectations, strict, default_handler);
diff --git a/crates/shirabe/tests/common/test_case.rs b/crates/shirabe/tests/common/test_case.rs
index 7365f734..5bfc2d0f 100644
--- a/crates/shirabe/tests/common/test_case.rs
+++ b/crates/shirabe/tests/common/test_case.rs
@@ -30,9 +30,7 @@ use shirabe_external_packages::symfony::console::output::stream_output::StreamOu
use shirabe_php_shim::{PhpMixed, PhpResource};
use shirabe_semver::VersionParser;
use shirabe_semver::constraint::{AnyConstraint, SimpleConstraint};
-use std::cell::RefCell;
use std::path::PathBuf;
-use std::rc::Rc;
use tempfile::TempDir;
/// ref: TestCase::getPackage (default class CompletePackage)
@@ -170,17 +168,22 @@ pub fn init_temp_composer(
}
}
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(NullIO::new()))
+fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))
}
/// ref: FactoryMock::createInstallationManager (the real installers are never created in tests, so a
/// bare InstallationManager over a mock HttpDownloader suffices).
-fn installation_manager(io: &Rc<RefCell<dyn IOInterface>>) -> Rc<RefCell<InstallationManager>> {
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(io.clone(), config)));
- let r#loop = Rc::new(RefCell::new(Loop::new(http_downloader, None)));
- Rc::new(RefCell::new(InstallationManager::new(
+fn installation_manager(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+) -> std::rc::Rc<std::cell::RefCell<InstallationManager>> {
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::__new_mock(
+ io.clone(),
+ config,
+ )));
+ let r#loop = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(http_downloader, None)));
+ std::rc::Rc::new(std::cell::RefCell::new(InstallationManager::new(
r#loop,
io.clone(),
None,
@@ -227,7 +230,9 @@ pub fn create_composer_lock(
let io = null_io();
let json_file = JsonFile::new("./composer.lock".to_string(), None, None).unwrap();
let composer_file_contents = std::fs::read_to_string("./composer.json").unwrap_or_default();
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
let mut locker = Locker::new(
io.clone(),
json_file,
@@ -279,7 +284,7 @@ pub struct ApplicationTester {
application: ApplicationHandle,
inputs: Vec<String>,
status_code: Option<i32>,
- output: Option<Rc<RefCell<dyn OutputInterface>>>,
+ output: Option<std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>>,
/// Handles retained before injection so `get_display`/`get_error_output` can read the memory
/// streams without relying on a `get_stream()` accessor across the ConsoleOutput composition gap.
output_stream: Option<PhpResource>,
@@ -320,7 +325,8 @@ impl ApplicationTester {
self.init_output(&options);
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(array_input));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(array_input));
let output = self.output.clone().expect("init_output initializes output");
let status_code = self.application.run(Some(input), Some(output))?;
@@ -346,7 +352,7 @@ impl ApplicationTester {
if let Some(verbosity) = options.verbosity {
output.set_verbosity(verbosity);
}
- self.output = Some(Rc::new(RefCell::new(output)));
+ self.output = Some(std::rc::Rc::new(std::cell::RefCell::new(output)));
} else {
let stdout = shirabe_php_shim::php_fopen_resource("php://memory", "w");
let stderr = shirabe_php_shim::php_fopen_resource("php://memory", "w");
@@ -363,10 +369,10 @@ impl ApplicationTester {
error_output.set_verbosity(output.get_verbosity());
error_output.set_decorated(output.is_decorated());
- output.set_error_output(Rc::new(RefCell::new(error_output)));
+ output.set_error_output(std::rc::Rc::new(std::cell::RefCell::new(error_output)));
output.__set_stream(stdout);
- self.output = Some(Rc::new(RefCell::new(output)));
+ self.output = Some(std::rc::Rc::new(std::cell::RefCell::new(output)));
}
}
diff --git a/crates/shirabe/tests/composer_test.rs b/crates/shirabe/tests/composer_test.rs
index c394f1e6..891a47f1 100644
--- a/crates/shirabe/tests/composer_test.rs
+++ b/crates/shirabe/tests/composer_test.rs
@@ -16,16 +16,16 @@ use shirabe::repository::RepositoryManagerInterface;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe::util::process_executor::ProcessExecutor;
-use std::cell::RefCell;
-use std::rc::Rc;
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(NullIO::new()))
+fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))
}
-fn http_downloader(io: &Rc<RefCell<dyn IOInterface>>) -> Rc<RefCell<HttpDownloader>> {
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- Rc::new(RefCell::new(HttpDownloader::new(
+fn http_downloader(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+) -> std::rc::Rc<std::cell::RefCell<HttpDownloader>> {
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config,
IndexMap::new(),
@@ -33,9 +33,14 @@ fn http_downloader(io: &Rc<RefCell<dyn IOInterface>>) -> Rc<RefCell<HttpDownload
)))
}
-fn installation_manager(io: &Rc<RefCell<dyn IOInterface>>) -> Rc<RefCell<InstallationManager>> {
- let r#loop = Rc::new(RefCell::new(Loop::new(http_downloader(io), None)));
- Rc::new(RefCell::new(InstallationManager::new(
+fn installation_manager(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+) -> std::rc::Rc<std::cell::RefCell<InstallationManager>> {
+ let r#loop = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(
+ http_downloader(io),
+ None,
+ )));
+ std::rc::Rc::new(std::cell::RefCell::new(InstallationManager::new(
r#loop,
io.clone(),
None,
@@ -61,48 +66,67 @@ fn test_set_get_locker() {
let mut composer = Composer::new();
let io = null_io();
let json_file = JsonFile::new("composer.lock".to_string(), None, None).unwrap();
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
- let locker: Rc<RefCell<dyn LockerInterface>> = Rc::new(RefCell::new(Locker::new(
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
io.clone(),
- json_file,
- installation_manager(&io),
- "{}",
- process,
- )));
+ ))));
+ let locker: std::rc::Rc<std::cell::RefCell<dyn LockerInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(Locker::new(
+ io.clone(),
+ json_file,
+ installation_manager(&io),
+ "{}",
+ process,
+ )));
composer.set_locker(locker.clone());
- assert!(Rc::ptr_eq(&composer.get_locker(), &locker));
+ assert!(std::rc::Rc::ptr_eq(&composer.get_locker(), &locker));
}
#[test]
fn test_set_get_repository_manager() {
let mut composer = Composer::new();
let io = null_io();
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- let manager: Rc<RefCell<dyn RepositoryManagerInterface>> = Rc::new(RefCell::new(
- RepositoryManager::new(io.clone(), config, http_downloader(&io), None, None),
- ));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let manager: std::rc::Rc<std::cell::RefCell<dyn RepositoryManagerInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(RepositoryManager::new(
+ io.clone(),
+ config,
+ http_downloader(&io),
+ None,
+ None,
+ )));
composer.set_repository_manager(manager.clone());
- assert!(Rc::ptr_eq(&composer.get_repository_manager(), &manager));
+ assert!(std::rc::Rc::ptr_eq(
+ &composer.get_repository_manager(),
+ &manager
+ ));
}
#[test]
fn test_set_get_download_manager() {
let mut composer = Composer::new();
- let manager: Rc<RefCell<dyn DownloadManagerInterface>> =
- Rc::new(RefCell::new(DownloadManager::new(null_io(), false, None)));
+ let manager: std::rc::Rc<std::cell::RefCell<dyn DownloadManagerInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(DownloadManager::new(null_io(), false, None)),
+ );
composer.set_download_manager(manager.clone());
- assert!(Rc::ptr_eq(&composer.get_download_manager(), &manager));
+ assert!(std::rc::Rc::ptr_eq(
+ &composer.get_download_manager(),
+ &manager
+ ));
}
#[test]
fn test_set_get_installation_manager() {
let mut composer = Composer::new();
let io = null_io();
- let manager: Rc<RefCell<dyn InstallationManagerInterface>> = installation_manager(&io);
+ let manager: std::rc::Rc<std::cell::RefCell<dyn InstallationManagerInterface>> =
+ installation_manager(&io);
composer.set_installation_manager(manager.clone());
- assert!(Rc::ptr_eq(&composer.get_installation_manager(), &manager));
+ assert!(std::rc::Rc::ptr_eq(
+ &composer.get_installation_manager(),
+ &manager
+ ));
}
diff --git a/crates/shirabe/tests/config/json_config_source_test.rs b/crates/shirabe/tests/config/json_config_source_test.rs
index 200a6216..155b83a7 100644
--- a/crates/shirabe/tests/config/json_config_source_test.rs
+++ b/crates/shirabe/tests/config/json_config_source_test.rs
@@ -6,9 +6,7 @@ use shirabe::config::JsonConfigSource;
use shirabe::json::JsonFile;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::path::PathBuf;
-use std::rc::Rc;
use tempfile::TempDir;
fn set_up() -> TearDown {
@@ -58,7 +56,7 @@ fn assert_file_equals(expected: &std::path::Path, actual: &std::path::Path) {
fn json_config_source(config: &std::path::Path) -> JsonConfigSource {
let json_file = JsonFile::new(config.to_string_lossy().to_string(), None, None).unwrap();
- JsonConfigSource::new(Rc::new(RefCell::new(json_file)), false)
+ JsonConfigSource::new(std::rc::Rc::new(std::cell::RefCell::new(json_file)), false)
}
#[test]
diff --git a/crates/shirabe/tests/config_test.rs b/crates/shirabe/tests/config_test.rs
index 61a1575a..e8feafd7 100644
--- a/crates/shirabe/tests/config_test.rs
+++ b/crates/shirabe/tests/config_test.rs
@@ -8,8 +8,6 @@ use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::Platform;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
#[path = "common/io_mock.rs"]
#[allow(dead_code)] // io_mock exposes more helpers than this binary uses
@@ -509,7 +507,7 @@ fn test_prohibited_urls_warning_verify_peer() {
.unwrap();
let mut config = Config::new(false, None);
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let mut repo_options: IndexMap<String, PhpMixed> = IndexMap::new();
repo_options.insert(
"ssl".to_string(),
diff --git a/crates/shirabe/tests/dependency_resolver/pool_builder_test.rs b/crates/shirabe/tests/dependency_resolver/pool_builder_test.rs
index 548cb0dc..e6897ff7 100644
--- a/crates/shirabe/tests/dependency_resolver/pool_builder_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/pool_builder_test.rs
@@ -22,9 +22,7 @@ use shirabe::repository::repository_set::{RepositorySet, RootAliasInput};
use shirabe_external_packages::composer::pcre::preg::Preg;
use shirabe_php_shim::PREG_SPLIT_DELIM_CAPTURE;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::path::PathBuf;
-use std::rc::Rc;
/// Maps the PHP `$loadPackage` closure: pops the optional `id` from the data, loads the
/// package and records it in `package_ids` keyed by that id (erroring on duplicates).
@@ -451,8 +449,9 @@ fn run_test_pool_builder(
IndexMap::new(),
IndexMap::new(),
);
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut rm = RepositoryFactory::manager(io.clone(), &config, None, None, None).unwrap();
// PHP: foreach ($packageRepos as $packages)
@@ -605,7 +604,8 @@ fn run_test_pool_builder(
message
);
- let mut optimizer = PoolOptimizer::new(Rc::new(DefaultPolicy::new(false, false, None)));
+ let mut optimizer =
+ PoolOptimizer::new(std::rc::Rc::new(DefaultPolicy::new(false, false, None)));
let optimized = optimizer.optimize(&request, &pool);
let mut result = get_package_result_set(&optimized, &package_ids);
let mut expect_optimized = expect_optimized.as_list().unwrap().clone();
diff --git a/crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs b/crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs
index 3c4952e7..08d5f989 100644
--- a/crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/pool_optimizer_test.rs
@@ -15,7 +15,6 @@ use shirabe_external_packages::composer::pcre::preg::Preg;
use shirabe_php_shim::PREG_SPLIT_DELIM_CAPTURE;
use shirabe_php_shim::PhpMixed;
use std::path::PathBuf;
-use std::rc::Rc;
fn load_package(package_data: &PhpMixed) -> BasePackageHandle {
let loader = ArrayLoader::new(None, false);
@@ -237,7 +236,7 @@ fn run_test_pool_optimizer(
IndexMap::new(),
IndexMap::new(),
);
- let mut pool_optimizer = PoolOptimizer::new(Rc::new(DefaultPolicy::new(
+ let mut pool_optimizer = PoolOptimizer::new(std::rc::Rc::new(DefaultPolicy::new(
prefer_stable,
prefer_lowest,
None,
diff --git a/crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs b/crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs
index 9c9f85bd..93e25962 100644
--- a/crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/rule_set_iterator_test.rs
@@ -7,13 +7,11 @@ use shirabe::dependency_resolver::rule::{RULE_LEARNED, RULE_ROOT_REQUIRE, Reason
use shirabe::dependency_resolver::rule_set::RuleSet;
use shirabe::dependency_resolver::rule_set_iterator::RuleSetIterator;
use shirabe_semver::constraint::MatchAllConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
-type Rules = IndexMap<i64, Vec<Rc<RefCell<Rule>>>>;
+type Rules = IndexMap<i64, Vec<std::rc::Rc<std::cell::RefCell<Rule>>>>;
-fn root_require_rule() -> Rc<RefCell<Rule>> {
- Rc::new(RefCell::new(Rule::Generic(GenericRule::new(
+fn root_require_rule() -> std::rc::Rc<std::cell::RefCell<Rule>> {
+ std::rc::Rc::new(std::cell::RefCell::new(Rule::Generic(GenericRule::new(
vec![],
RULE_ROOT_REQUIRE,
ReasonData::RootRequire {
@@ -40,11 +38,9 @@ fn set_up() -> (Pool, Rules) {
);
rules.insert(
RuleSet::TYPE_LEARNED,
- vec![Rc::new(RefCell::new(Rule::Generic(GenericRule::new(
- vec![],
- RULE_LEARNED,
- ReasonData::Int(1),
- ))))],
+ vec![std::rc::Rc::new(std::cell::RefCell::new(Rule::Generic(
+ GenericRule::new(vec![], RULE_LEARNED, ReasonData::Int(1)),
+ )))],
);
rules.insert(RuleSet::TYPE_PACKAGE, vec![]);
@@ -56,7 +52,7 @@ fn test_foreach() {
let (_pool, rules) = set_up();
let mut rule_set_iterator = RuleSetIterator::new(rules.clone());
- let mut result: Vec<Rc<RefCell<Rule>>> = Vec::new();
+ let mut result: Vec<std::rc::Rc<std::cell::RefCell<Rule>>> = Vec::new();
while rule_set_iterator.valid() {
result.push(rule_set_iterator.current());
rule_set_iterator.next();
@@ -70,7 +66,7 @@ fn test_foreach() {
assert_eq!(expected.len(), result.len());
for (e, r) in expected.iter().zip(result.iter()) {
- assert!(Rc::ptr_eq(e, r));
+ assert!(std::rc::Rc::ptr_eq(e, r));
}
}
diff --git a/crates/shirabe/tests/dependency_resolver/rule_set_test.rs b/crates/shirabe/tests/dependency_resolver/rule_set_test.rs
index 3ed974e6..0a9582dc 100644
--- a/crates/shirabe/tests/dependency_resolver/rule_set_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/rule_set_test.rs
@@ -7,8 +7,6 @@ use shirabe::dependency_resolver::{
};
use shirabe::repository::RepositorySet;
use shirabe_semver::constraint::{MatchAllConstraint, MatchNoneConstraint};
-use std::cell::RefCell;
-use std::rc::Rc;
fn root_require_reason() -> ReasonData {
ReasonData::RootRequire {
@@ -17,16 +15,16 @@ fn root_require_reason() -> ReasonData {
}
}
-fn rule(literals: Vec<i64>) -> Rc<RefCell<Rule>> {
- Rc::new(RefCell::new(Rule::Generic(GenericRule::new(
+fn rule(literals: Vec<i64>) -> std::rc::Rc<std::cell::RefCell<Rule>> {
+ std::rc::Rc::new(std::cell::RefCell::new(Rule::Generic(GenericRule::new(
literals,
RULE_ROOT_REQUIRE,
root_require_reason(),
))))
}
-fn learned_rule() -> Rc<RefCell<Rule>> {
- Rc::new(RefCell::new(Rule::Generic(GenericRule::new(
+fn learned_rule() -> std::rc::Rc<std::cell::RefCell<Rule>> {
+ std::rc::Rc::new(std::cell::RefCell::new(Rule::Generic(GenericRule::new(
vec![],
RULE_LEARNED,
ReasonData::Int(1),
@@ -67,11 +65,11 @@ fn test_add() {
);
let request = &rules[&RuleSet::TYPE_REQUEST];
assert_eq!(2, request.len());
- assert!(Rc::ptr_eq(&request[0], &request0));
- assert!(Rc::ptr_eq(&request[1], &request1));
+ assert!(std::rc::Rc::ptr_eq(&request[0], &request0));
+ assert!(std::rc::Rc::ptr_eq(&request[1], &request1));
let learned = &rules[&RuleSet::TYPE_LEARNED];
assert_eq!(1, learned.len());
- assert!(Rc::ptr_eq(&learned[0], &learned0));
+ assert!(std::rc::Rc::ptr_eq(&learned[0], &learned0));
}
#[test]
@@ -110,7 +108,7 @@ fn test_rule_by_id() {
let rule = rule(vec![]);
rule_set.add(rule.clone(), RuleSet::TYPE_REQUEST).unwrap();
- assert!(Rc::ptr_eq(&rule_set.rule_by_id[&0], &rule));
+ assert!(std::rc::Rc::ptr_eq(&rule_set.rule_by_id[&0], &rule));
}
#[test]
@@ -122,9 +120,9 @@ fn test_get_iterator() {
rule_set.add(rule2.clone(), RuleSet::TYPE_LEARNED).unwrap();
let mut iterator = rule_set.get_iterator();
- assert!(Rc::ptr_eq(&iterator.current(), &rule1));
+ assert!(std::rc::Rc::ptr_eq(&iterator.current(), &rule1));
iterator.next();
- assert!(Rc::ptr_eq(&iterator.current(), &rule2));
+ assert!(std::rc::Rc::ptr_eq(&iterator.current(), &rule2));
}
#[test]
@@ -136,7 +134,7 @@ fn test_get_iterator_for() {
rule_set.add(rule2.clone(), RuleSet::TYPE_LEARNED).unwrap();
let iterator = rule_set.get_iterator_for(vec![RuleSet::TYPE_LEARNED]);
- assert!(Rc::ptr_eq(&iterator.current(), &rule2));
+ assert!(std::rc::Rc::ptr_eq(&iterator.current(), &rule2));
}
#[test]
@@ -148,7 +146,7 @@ fn test_get_iterator_without() {
rule_set.add(rule2.clone(), RuleSet::TYPE_LEARNED).unwrap();
let iterator = rule_set.get_iterator_without(vec![RuleSet::TYPE_REQUEST]);
- assert!(Rc::ptr_eq(&iterator.current(), &rule2));
+ assert!(std::rc::Rc::ptr_eq(&iterator.current(), &rule2));
}
// The constraint is MatchNoneConstraint, so what_provides returns no packages and the
@@ -178,7 +176,7 @@ fn test_pretty_string() {
let mut rule_set = RuleSet::new();
let literal = p.get_id();
- let rule = Rc::new(RefCell::new(Rule::Generic(GenericRule::new(
+ let rule = std::rc::Rc::new(std::cell::RefCell::new(Rule::Generic(GenericRule::new(
vec![literal],
RULE_ROOT_REQUIRE,
ReasonData::RootRequire {
diff --git a/crates/shirabe/tests/dependency_resolver/solver_test.rs b/crates/shirabe/tests/dependency_resolver/solver_test.rs
index c20fd4c5..b8be2287 100644
--- a/crates/shirabe/tests/dependency_resolver/solver_test.rs
+++ b/crates/shirabe/tests/dependency_resolver/solver_test.rs
@@ -16,8 +16,6 @@ use shirabe::repository::handle::{LockArrayRepositoryHandle, RepositoryInterface
use shirabe::repository::lock_array_repository::LockArrayRepository;
use shirabe::repository::repository_set::RepositorySet;
use shirabe_semver::constraint::{AnyConstraint, MatchAllConstraint, MultiConstraint};
-use std::cell::RefCell;
-use std::rc::Rc;
#[allow(dead_code)]
struct Fixtures {
@@ -122,13 +120,18 @@ fn check_solver_result_repo_set(
expected: Vec<ExpectedJob>,
) {
// createSolver()
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let pool = repo_set
.create_pool(&mut request, io.clone(), None, None, vec![], None, None)
.unwrap();
- let policy: Rc<dyn PolicyInterface> = Rc::new(DefaultPolicy::new(false, false, None));
- let mut solver =
- shirabe::dependency_resolver::solver::Solver::new(policy, Rc::new(RefCell::new(pool)), io);
+ let policy: std::rc::Rc<dyn PolicyInterface> =
+ std::rc::Rc::new(DefaultPolicy::new(false, false, None));
+ let mut solver = shirabe::dependency_resolver::solver::Solver::new(
+ policy,
+ std::rc::Rc::new(std::cell::RefCell::new(pool)),
+ io,
+ );
let transaction = solver.solve(&request, None).unwrap().unwrap();
@@ -197,7 +200,7 @@ struct SolveError {
exception: SolverProblemsException,
repo_set: RepositorySet,
request: Request,
- pool: Rc<RefCell<Pool>>,
+ pool: std::rc::Rc<std::cell::RefCell<Pool>>,
}
/// ref: SolverTest::createSolver + solve, returning the caught SolverProblemsException.
@@ -212,13 +215,15 @@ fn solve_expecting_problems(
.unwrap();
repo_set.add_repository(repo_locked.into()).unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let pool = Rc::new(RefCell::new(
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let pool = std::rc::Rc::new(std::cell::RefCell::new(
repo_set
.create_pool(&mut request, io.clone(), None, None, vec![], None, None)
.unwrap(),
));
- let policy: Rc<dyn PolicyInterface> = Rc::new(DefaultPolicy::new(false, false, None));
+ let policy: std::rc::Rc<dyn PolicyInterface> =
+ std::rc::Rc::new(DefaultPolicy::new(false, false, None));
let mut solver = shirabe::dependency_resolver::solver::Solver::new(policy, pool.clone(), io);
let exception = match solver.solve(&request, None).unwrap() {
@@ -2489,13 +2494,18 @@ fn test_learn_positive_literal() {
let mut request = fixtures.request;
request.require_name("A", None).unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let pool = repo_set
.create_pool(&mut request, io.clone(), None, None, vec![], None, None)
.unwrap();
- let policy: Rc<dyn PolicyInterface> = Rc::new(DefaultPolicy::new(false, false, None));
- let mut solver =
- shirabe::dependency_resolver::solver::Solver::new(policy, Rc::new(RefCell::new(pool)), io);
+ let policy: std::rc::Rc<dyn PolicyInterface> =
+ std::rc::Rc::new(DefaultPolicy::new(false, false, None));
+ let mut solver = shirabe::dependency_resolver::solver::Solver::new(
+ policy,
+ std::rc::Rc::new(std::cell::RefCell::new(pool)),
+ io,
+ );
// check correct setup for assertion later
assert!(!solver.test_flag_learned_positive_literal);
diff --git a/crates/shirabe/tests/documentation_test.rs b/crates/shirabe/tests/documentation_test.rs
index 7dc049cf..7a13ce1d 100644
--- a/crates/shirabe/tests/documentation_test.rs
+++ b/crates/shirabe/tests/documentation_test.rs
@@ -3,10 +3,8 @@
use shirabe::console::application::ApplicationHandle;
use shirabe_external_packages::symfony::console::command::Command;
use shirabe_external_packages::symfony::console::descriptor::application_description::ApplicationDescription;
-use std::cell::RefCell;
-use std::rc::Rc;
-fn get_command_name(command: &Rc<RefCell<dyn Command>>) -> String {
+fn get_command_name(command: &std::rc::Rc<std::cell::RefCell<dyn Command>>) -> String {
let mut name = command.borrow().get_name().unwrap_or_default();
for alias in command.borrow().get_aliases() {
name = format!("{} / {}", name, alias);
@@ -15,7 +13,7 @@ fn get_command_name(command: &Rc<RefCell<dyn Command>>) -> String {
name
}
-fn provide_command_cases() -> Vec<Rc<RefCell<dyn Command>>> {
+fn provide_command_cases() -> Vec<std::rc::Rc<std::cell::RefCell<dyn Command>>> {
let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap();
application.set_catch_exceptions(false);
diff --git a/crates/shirabe/tests/downloader/archive_downloader_test.rs b/crates/shirabe/tests/downloader/archive_downloader_test.rs
index fedbae9e..77569e97 100644
--- a/crates/shirabe/tests/downloader/archive_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/archive_downloader_test.rs
@@ -15,8 +15,6 @@ use shirabe::package::handle::{CompletePackageHandle, PackageInterfaceHandle};
use shirabe::util::HttpDownloader;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
/// ref: TestCase::getPackage (default class CompletePackage)
fn get_package(name: &str, version: &str) -> PackageInterfaceHandle {
@@ -27,7 +25,8 @@ fn get_package(name: &str, version: &str) -> PackageInterfaceHandle {
/// ref: ArchiveDownloaderTest::getArchiveDownloaderMock (the inherited getFileName/processUrl
/// live on FileDownloader, so the concrete downloader is built directly).
fn get_archive_downloader(vendor_dir: Option<&str>) -> FileDownloader {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut config = Config::new(false, None);
if let Some(vendor_dir) = vendor_dir {
@@ -40,9 +39,9 @@ fn get_archive_downloader(vendor_dir: Option<&str>) -> FileDownloader {
merged.insert("config".to_string(), PhpMixed::Array(config_options));
config.merge(&merged, "test");
}
- let config = Rc::new(RefCell::new(config));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::new(
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config.clone(),
IndexMap::new(),
diff --git a/crates/shirabe/tests/downloader/download_manager_test.rs b/crates/shirabe/tests/downloader/download_manager_test.rs
index 3b259c86..f596beed 100644
--- a/crates/shirabe/tests/downloader/download_manager_test.rs
+++ b/crates/shirabe/tests/downloader/download_manager_test.rs
@@ -8,8 +8,6 @@ use shirabe::io::IOInterface;
use shirabe::package::handle::{CompletePackageHandle, PackageInterfaceHandle};
use shirabe_php_shim::{PhpMixed, RuntimeException};
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
// PHP mocks `Composer\Downloader\DownloaderInterface` with getMockBuilder.
mockall::mock! {
@@ -91,7 +89,7 @@ fn make_package(name: &str, is_dev: bool) -> PackageInterfaceHandle {
}
/// ref: DownloadManagerTest::createDownloaderMock
-fn create_downloader_mock() -> Rc<RefCell<dyn DownloaderInterface>> {
+fn create_downloader_mock() -> std::rc::Rc<std::cell::RefCell<dyn DownloaderInterface>> {
as_dyn(MockDownloader::new())
}
@@ -107,12 +105,14 @@ fn downloader_mock(installation_source: &str) -> MockDownloader {
downloader
}
-fn as_dyn(downloader: MockDownloader) -> Rc<RefCell<dyn DownloaderInterface>> {
- Rc::new(RefCell::new(downloader)) as Rc<RefCell<dyn DownloaderInterface>>
+fn as_dyn(downloader: MockDownloader) -> std::rc::Rc<std::cell::RefCell<dyn DownloaderInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(downloader))
+ as std::rc::Rc<std::cell::RefCell<dyn DownloaderInterface>>
}
fn create_manager() -> DownloadManager {
- let io = Rc::new(RefCell::new(IOStub::new())) as Rc<RefCell<dyn IOInterface>>;
+ let io = std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()))
+ as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>;
DownloadManager::new(io, false, None)
}
@@ -122,7 +122,7 @@ fn test_set_get_downloader() {
let mut manager = create_manager();
manager.set_downloader("test", downloader.clone());
- assert!(Rc::ptr_eq(
+ assert!(std::rc::Rc::ptr_eq(
&downloader,
&manager.get_downloader("test").unwrap()
));
@@ -172,7 +172,7 @@ fn test_get_downloader_for_correctly_installed_dist_package() {
.get_downloader_for_package(package)
.unwrap()
.unwrap();
- assert!(Rc::ptr_eq(&downloader, &result));
+ assert!(std::rc::Rc::ptr_eq(&downloader, &result));
}
// The LogicException message uses get_class($downloader); the equivalent
@@ -209,7 +209,7 @@ fn test_get_downloader_for_correctly_installed_source_package() {
.get_downloader_for_package(package)
.unwrap()
.unwrap();
- assert!(Rc::ptr_eq(&downloader, &result));
+ assert!(std::rc::Rc::ptr_eq(&downloader, &result));
}
// See test_get_downloader_for_incorrectly_installed_dist_package: the LogicException
diff --git a/crates/shirabe/tests/downloader/file_downloader_test.rs b/crates/shirabe/tests/downloader/file_downloader_test.rs
index ead577e2..2fd7d52e 100644
--- a/crates/shirabe/tests/downloader/file_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/file_downloader_test.rs
@@ -20,8 +20,6 @@ use shirabe_php_shim::{
InvalidArgumentException, PhpMixed, RuntimeException, UnexpectedValueException,
};
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
/// ref: TestCase::getPackage (default class CompletePackage)
@@ -38,14 +36,16 @@ fn run<F: std::future::Future>(future: F) -> F::Output {
}
/// ref: TestCase::getConfig
-fn get_config(config_options: IndexMap<String, PhpMixed>) -> Rc<RefCell<Config>> {
+fn get_config(
+ config_options: IndexMap<String, PhpMixed>,
+) -> std::rc::Rc<std::cell::RefCell<Config>> {
let mut config = Config::new(false, None);
if !config_options.is_empty() {
let mut merged: IndexMap<String, PhpMixed> = IndexMap::new();
merged.insert("config".to_string(), PhpMixed::Array(config_options));
config.merge(&merged, "test");
}
- Rc::new(RefCell::new(config))
+ std::rc::Rc::new(std::cell::RefCell::new(config))
}
/// The PHP `getDownloader` builds a HttpDownloader mock whose `addCopy` resolves to a 200 Response
@@ -53,15 +53,16 @@ fn get_config(config_options: IndexMap<String, PhpMixed>) -> Rc<RefCell<Config>>
/// handler returning a 200/`file~` response for any URL. The mock never writes the destination file,
/// so the verification step throws "could not be saved to" exactly as in PHP.
fn get_downloader(
- io: Option<Rc<RefCell<dyn IOInterface>>>,
- config: Option<Rc<RefCell<Config>>>,
+ io: Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>,
+ config: Option<std::rc::Rc<std::cell::RefCell<Config>>>,
) -> (
FileDownloader,
- Rc<RefCell<HttpDownloader>>,
+ std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
crate::http_downloader_mock::HttpDownloaderMockGuard,
) {
- let io = io.unwrap_or_else(|| Rc::new(RefCell::new(NullIO::new())));
- let config = config.unwrap_or_else(|| Rc::new(RefCell::new(Config::new(false, None))));
+ let io = io.unwrap_or_else(|| std::rc::Rc::new(std::cell::RefCell::new(NullIO::new())));
+ let config = config
+ .unwrap_or_else(|| std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None))));
let (http_downloader, guard) = get_http_downloader_mock(
Vec::new(),
@@ -213,14 +214,15 @@ fn test_cache_garbage_collection_is_called() {
// The PHP Cache mock forces gcIsNecessary() true and records the single gc() call; the CacheMock
// seam plays both roles here.
let tmp_dir = TempDir::new().unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut cache = Cache::new(io, tmp_dir.path().to_str().unwrap(), None, None, false);
cache.__set_mock(CacheMock {
gc_is_necessary: Some(true),
gc_calls: Some(Vec::new()),
..Default::default()
});
- let cache = Rc::new(RefCell::new(cache));
+ let cache = std::rc::Rc::new(std::cell::RefCell::new(cache));
let (http_downloader, _guard) = get_http_downloader_mock(
Vec::new(),
@@ -232,7 +234,8 @@ fn test_cache_garbage_collection_is_called() {
},
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let _downloader = FileDownloader::new(
io,
config,
@@ -334,7 +337,7 @@ fn test_downgrade_shows_appropriate_message() {
normalize_path_identity: true,
..Default::default()
});
- let filesystem = Rc::new(RefCell::new(filesystem));
+ let filesystem = std::rc::Rc::new(std::cell::RefCell::new(filesystem));
let (http_downloader, _guard) = get_http_downloader_mock(
Vec::new(),
@@ -346,7 +349,7 @@ fn test_downgrade_shows_appropriate_message() {
},
);
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let mut downloader = FileDownloader::new(
io,
config,
diff --git a/crates/shirabe/tests/downloader/fossil_downloader_test.rs b/crates/shirabe/tests/downloader/fossil_downloader_test.rs
index 912b4b47..eed3d7fb 100644
--- a/crates/shirabe/tests/downloader/fossil_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/fossil_downloader_test.rs
@@ -12,8 +12,6 @@ use shirabe::util::ProcessExecutor;
use shirabe::util::filesystem::{Filesystem, FilesystemMock};
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
fn run<F: std::future::Future>(future: F) -> F::Output {
@@ -67,20 +65,23 @@ fn get_package(source_reference: Option<&str>, source_url: Option<&str>) -> Pack
/// ref: FossilDownloaderTest::getDownloaderMock
fn get_downloader_mock(
- io: Option<Rc<RefCell<dyn IOInterface>>>,
+ io: Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>,
config: Option<Config>,
- process: Rc<RefCell<ProcessExecutor>>,
- filesystem: Option<Rc<RefCell<Filesystem>>>,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
+ filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
) -> FossilDownloader {
- let io =
- io.unwrap_or_else(|| Rc::new(RefCell::new(IOStub::new())) as Rc<RefCell<dyn IOInterface>>);
+ let io = io.unwrap_or_else(|| {
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()))
+ as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>
+ });
// ref: getConfig(['secure-http' => false])
- let config = Rc::new(RefCell::new(config.unwrap_or_else(|| {
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config.unwrap_or_else(|| {
ConfigStubBuilder::new()
.with("secure-http", PhpMixed::Bool(false))
.build()
})));
- let fs = filesystem.unwrap_or_else(|| Rc::new(RefCell::new(Filesystem::new(None))));
+ let fs = filesystem
+ .unwrap_or_else(|| std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None))));
FossilDownloader::new(io, config, process, fs)
}
@@ -232,7 +233,7 @@ fn test_remove() {
remove_directory_async_result: Some(true),
..Default::default()
});
- let filesystem = Rc::new(RefCell::new(filesystem));
+ let filesystem = std::rc::Rc::new(std::cell::RefCell::new(filesystem));
let mut downloader = get_downloader_mock(None, None, process, Some(filesystem.clone()));
run(async {
diff --git a/crates/shirabe/tests/downloader/git_downloader_test.rs b/crates/shirabe/tests/downloader/git_downloader_test.rs
index 7e98cae8..0d8af4e9 100644
--- a/crates/shirabe/tests/downloader/git_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/git_downloader_test.rs
@@ -18,8 +18,6 @@ use shirabe::util::ProcessExecutor;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
fn run<F: std::future::Future>(future: F) -> F::Output {
@@ -104,14 +102,16 @@ fn setup_config(config: Config) -> Config {
/// ref: GitDownloaderTest::getDownloaderMock (defaults the IO/Config/Filesystem)
fn get_downloader_mock(
- io: Option<Rc<RefCell<dyn IOInterface>>>,
+ io: Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>,
config: Option<Config>,
- process: Rc<RefCell<ProcessExecutor>>,
- filesystem: Option<Rc<RefCell<Filesystem>>>,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
+ filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
) -> GitDownloader {
- let io =
- io.unwrap_or_else(|| Rc::new(RefCell::new(IOStub::new())) as Rc<RefCell<dyn IOInterface>>);
- let config = Rc::new(RefCell::new(setup_config(
+ let io = io.unwrap_or_else(|| {
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()))
+ as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>
+ });
+ let config = std::rc::Rc::new(std::cell::RefCell::new(setup_config(
config.unwrap_or_else(|| ConfigStubBuilder::new().build()),
)));
GitDownloader::new(io, config, Some(process), filesystem)
@@ -804,7 +804,7 @@ fn test_downgrade_shows_appropriate_message() {
.borrow_mut()
.expects(vec![Expectation::text_regex("{Downgrading .*}")], false)
.unwrap();
- let io = io_mock.clone() as Rc<RefCell<dyn IOInterface>>;
+ let io = io_mock.clone() as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>;
let mut fs = Filesystem::new(None);
fs.ensure_directory_exists(&format!("{}/.git", working_dir.path().to_string_lossy()))
@@ -882,7 +882,7 @@ fn test_not_using_downgrading_with_references() {
.borrow_mut()
.expects(vec![Expectation::text_regex("{Upgrading .*}")], false)
.unwrap();
- let io = io_mock.clone() as Rc<RefCell<dyn IOInterface>>;
+ let io = io_mock.clone() as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>;
let mut fs = Filesystem::new(None);
fs.ensure_directory_exists(&format!("{}/.git", working_dir.path().to_string_lossy()))
diff --git a/crates/shirabe/tests/downloader/hg_downloader_test.rs b/crates/shirabe/tests/downloader/hg_downloader_test.rs
index e68dfc5e..d68812d8 100644
--- a/crates/shirabe/tests/downloader/hg_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/hg_downloader_test.rs
@@ -10,8 +10,6 @@ use shirabe::package::handle::{CompletePackageHandle, PackageInterfaceHandle};
use shirabe::util::ProcessExecutor;
use shirabe::util::filesystem::{Filesystem, FilesystemMock};
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
fn run<F: std::future::Future>(future: F) -> F::Output {
@@ -69,17 +67,20 @@ fn get_package(source_reference: Option<&str>, source_url: Option<&str>) -> Pack
/// returns null for everything; a default real `Config` resolves the only
/// relevant key (`secure-http`) compatibly for the https URLs used here.
fn get_downloader_mock(
- io: Option<Rc<RefCell<dyn IOInterface>>>,
+ io: Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>,
config: Option<Config>,
- process: Rc<RefCell<ProcessExecutor>>,
- filesystem: Option<Rc<RefCell<Filesystem>>>,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
+ filesystem: Option<std::rc::Rc<std::cell::RefCell<Filesystem>>>,
) -> HgDownloader {
- let io =
- io.unwrap_or_else(|| Rc::new(RefCell::new(IOStub::new())) as Rc<RefCell<dyn IOInterface>>);
- let config = Rc::new(RefCell::new(
+ let io = io.unwrap_or_else(|| {
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()))
+ as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>
+ });
+ let config = std::rc::Rc::new(std::cell::RefCell::new(
config.unwrap_or_else(|| Config::new(false, None)),
));
- let fs = filesystem.unwrap_or_else(|| Rc::new(RefCell::new(Filesystem::new(None))));
+ let fs = filesystem
+ .unwrap_or_else(|| std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None))));
HgDownloader::new(io, config, process, fs)
}
@@ -224,7 +225,7 @@ fn test_remove() {
remove_directory_async_result: Some(true),
..Default::default()
});
- let filesystem = Rc::new(RefCell::new(filesystem));
+ let filesystem = std::rc::Rc::new(std::cell::RefCell::new(filesystem));
let mut downloader = get_downloader_mock(None, None, process, Some(filesystem.clone()));
run(async {
diff --git a/crates/shirabe/tests/downloader/perforce_downloader_test.rs b/crates/shirabe/tests/downloader/perforce_downloader_test.rs
index 70f28e10..13a818a6 100644
--- a/crates/shirabe/tests/downloader/perforce_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/perforce_downloader_test.rs
@@ -14,8 +14,6 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
// A getMockBuilder('Composer\Util\Perforce') stand-in: the seam trait extracted from the
@@ -83,13 +81,14 @@ fn test_init_perforce_instantiates_a_new_perforce_object() {
// RepositoryInterface), so it cannot be held in a RepositoryInterfaceHandle. The package
// is therefore built without a repository, yielding an empty repo config.
let test_path = TempDir::new().unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
- let config = Rc::new(RefCell::new(get_config(test_path.path())));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(get_config(test_path.path())));
let package = make_package(None);
let (process, _process_guard) =
get_process_executor_mock(vec![], false, MockHandler::default());
- let fs = Rc::new(RefCell::new(Filesystem::new(None)));
+ let fs = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None)));
let mut downloader = PerforceDownloader::new(io, config, process, fs);
downloader.init_perforce(
@@ -102,11 +101,12 @@ fn test_init_perforce_instantiates_a_new_perforce_object() {
#[test]
fn test_init_perforce_does_nothing_if_perforce_already_set() {
let test_path = TempDir::new().unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
- let config = Rc::new(RefCell::new(get_config(test_path.path())));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(get_config(test_path.path())));
let (process, _process_guard) =
get_process_executor_mock(vec![], false, MockHandler::default());
- let fs = Rc::new(RefCell::new(Filesystem::new(None)));
+ let fs = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None)));
let mut downloader = PerforceDownloader::new(io, config, process, fs);
// The already-set perforce only sees initializePath; the repository's getRepoConfig is
@@ -147,11 +147,11 @@ fn do_install_workflow(source_ref: &'static str, expected_label: Option<String>)
false,
)
.unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
- let config = Rc::new(RefCell::new(get_config(test_path.path())));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
+ let config = std::rc::Rc::new(std::cell::RefCell::new(get_config(test_path.path())));
let (process, _process_guard) =
get_process_executor_mock(vec![], false, MockHandler::default());
- let fs = Rc::new(RefCell::new(Filesystem::new(None)));
+ let fs = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None)));
let mut downloader = PerforceDownloader::new(io, config, process, fs);
let mut perforce = MockPerforce::new();
diff --git a/crates/shirabe/tests/downloader/xz_downloader_test.rs b/crates/shirabe/tests/downloader/xz_downloader_test.rs
index 358f8964..6d504313 100644
--- a/crates/shirabe/tests/downloader/xz_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/xz_downloader_test.rs
@@ -14,8 +14,6 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
/// ref: TestCase::getPackage (default class CompletePackage)
@@ -82,21 +80,24 @@ fn test_error_messages() {
let dist_url = format!("file://{}", file!());
package.set_dist_url(Some(dist_url));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut config_options: IndexMap<String, PhpMixed> = IndexMap::new();
config_options.insert(
"vendor-dir".to_string(),
PhpMixed::String(test_dir.to_string_lossy().into_owned()),
);
- let config = Rc::new(RefCell::new(get_config(config_options, false)));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::new(
+ let config = std::rc::Rc::new(std::cell::RefCell::new(get_config(config_options, false)));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config.clone(),
IndexMap::new(),
false,
)));
- let filesystem = Rc::new(RefCell::new(Filesystem::new(None)));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
+ let filesystem = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
let mut downloader = XzDownloader::new(
io,
config,
diff --git a/crates/shirabe/tests/downloader/zip_downloader_test.rs b/crates/shirabe/tests/downloader/zip_downloader_test.rs
index 43e79160..0c9e7b88 100644
--- a/crates/shirabe/tests/downloader/zip_downloader_test.rs
+++ b/crates/shirabe/tests/downloader/zip_downloader_test.rs
@@ -15,8 +15,6 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::{PhpMixed, ZipArchive, ZipArchiveMock};
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
fn run<F: std::future::Future>(future: F) -> F::Output {
@@ -28,9 +26,9 @@ fn run<F: std::future::Future>(future: F) -> F::Output {
struct SetUp {
test_dir: TempDir,
- io: Rc<RefCell<dyn IOInterface>>,
- config: Rc<RefCell<Config>>,
- http_downloader: Rc<RefCell<HttpDownloader>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
package: PackageInterfaceHandle,
filename: std::path::PathBuf,
}
@@ -44,10 +42,11 @@ struct SetUp {
fn set_up() -> SetUp {
let test_dir = TempDir::new().unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- let dl_config = Rc::new(RefCell::new(Config::new(false, None)));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let dl_config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::__new_mock(
io.clone(),
dl_config,
)));
@@ -94,8 +93,10 @@ impl Drop for TearDown {
}
fn make_downloader(set_up: &SetUp) -> ZipDownloader {
- let filesystem = Rc::new(RefCell::new(Filesystem::new(None)));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(set_up.io.clone()))));
+ let filesystem = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ set_up.io.clone(),
+ ))));
ZipDownloader::new(
set_up.io.clone(),
set_up.config.clone(),
@@ -124,7 +125,8 @@ fn test_error_messages() {
let test_dir = TempDir::new().unwrap();
let _tear_down = TearDown::new(test_dir.path().to_path_buf());
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
// $this->config->method('get')->with('vendor-dir')->willReturn($this->testDir)
let mut config = Config::new(false, None);
@@ -136,11 +138,11 @@ fn test_error_messages() {
let mut merged: IndexMap<String, PhpMixed> = IndexMap::new();
merged.insert("config".to_string(), PhpMixed::Array(config_options));
config.merge(&merged, "test");
- let config = Rc::new(RefCell::new(config));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
// new HttpDownloader($this->io, $dlConfig): a real downloader (not the extract-path mock).
- let dl_config = Rc::new(RefCell::new(Config::new(false, None)));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::new(
+ let dl_config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
dl_config,
IndexMap::new(),
@@ -155,8 +157,10 @@ fn test_error_messages() {
.into();
package.set_dist_url(Some(dist_url));
- let filesystem = Rc::new(RefCell::new(Filesystem::new(None)));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
+ let filesystem = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
let mut downloader = ZipDownloader::new(
io,
config,
diff --git a/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs b/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
index cabb6794..67059a7c 100644
--- a/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
+++ b/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs
@@ -17,8 +17,6 @@ use shirabe::util::platform::Platform;
use shirabe::util::process_executor::{MockHandler, ProcessExecutor};
use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::PHP_EOL;
-use std::cell::RefCell;
-use std::rc::Rc;
fn tear_down() {
Platform::clear_env("COMPOSER_SKIP_SCRIPTS");
@@ -40,9 +38,10 @@ impl Drop for TearDown {
/// here drive only command-line / composer-script listeners, which never touch those collaborators,
/// so a minimal full Composer carrying a Config and a RootPackage is sufficient.
fn create_composer_instance() -> ComposerHandle {
- let composer =
- ComposerHandle::from_rc_unchecked(Rc::new(RefCell::new(PartialOrFullComposer::new_full())));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let composer = ComposerHandle::from_rc_unchecked(std::rc::Rc::new(std::cell::RefCell::new(
+ PartialOrFullComposer::new_full(),
+ )));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
composer.borrow_mut().set_config(config);
let package: RootPackageInterfaceHandle = RootPackageHandle::new(
"foo".to_string(),
@@ -54,8 +53,8 @@ fn create_composer_instance() -> ComposerHandle {
composer
}
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(shirabe::io::null_io::NullIO::new()))
+fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(shirabe::io::null_io::NullIO::new()))
}
/// Locates a `php` executable on PATH and points `PHP_BINARY` at it.
@@ -83,8 +82,8 @@ fn ensure_php_binary() -> bool {
false
}
-fn buffer_io_verbose() -> Rc<RefCell<BufferIO>> {
- Rc::new(RefCell::new(
+fn buffer_io_verbose() -> std::rc::Rc<std::cell::RefCell<BufferIO>> {
+ std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), output_interface::VERBOSITY_VERBOSE, None).unwrap(),
))
}
@@ -93,8 +92,8 @@ fn buffer_io_verbose() -> Rc<RefCell<BufferIO>> {
/// `getMockBuilder(EventDispatcher)->onlyMethods(['getListeners'])`.
fn dispatcher_with_listeners(
composer: &ComposerHandle,
- io: Rc<RefCell<dyn IOInterface>>,
- process: Rc<RefCell<ProcessExecutor>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
callback: Box<dyn Fn(&dyn EventInterface) -> Vec<Callable>>,
) -> EventDispatcher {
let mut dispatcher = EventDispatcher::new(composer.upcast().downgrade(), io, Some(process));
@@ -154,7 +153,7 @@ fn test_dispatcher_can_execute_composer_script_groups() {
let composer = create_composer_instance();
let io = buffer_io_verbose();
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io.clone();
let callback: Box<dyn Fn(&dyn EventInterface) -> Vec<Callable>> =
Box::new(|event| match event.get_name() {
@@ -205,7 +204,7 @@ fn test_recursion_in_scripts_names() {
let composer = create_composer_instance();
let io = buffer_io_verbose();
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io.clone();
let callback: Box<dyn Fn(&dyn EventInterface) -> Vec<Callable>> =
Box::new(|event| match event.get_name() {
diff --git a/crates/shirabe/tests/factory_test.rs b/crates/shirabe/tests/factory_test.rs
index 8685861a..be32dac3 100644
--- a/crates/shirabe/tests/factory_test.rs
+++ b/crates/shirabe/tests/factory_test.rs
@@ -7,8 +7,6 @@ use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::platform::Platform;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
#[path = "common/config_stub.rs"]
mod config_stub;
@@ -50,7 +48,7 @@ fn test_default_values_are_as_expected() {
.with("disable-tls", PhpMixed::Bool(true))
.build_shared();
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
Factory::create_http_downloader(io, &config, IndexMap::new()).unwrap();
}
diff --git a/crates/shirabe/tests/installer/binary_installer_test.rs b/crates/shirabe/tests/installer/binary_installer_test.rs
index 6b3cae5d..8b2d0636 100644
--- a/crates/shirabe/tests/installer/binary_installer_test.rs
+++ b/crates/shirabe/tests/installer/binary_installer_test.rs
@@ -7,9 +7,7 @@ use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::util::Filesystem;
use shirabe::util::ProcessExecutor;
-use std::cell::RefCell;
use std::fs;
-use std::rc::Rc;
use tempfile::TempDir;
/// Mirror of setUp(): builds temp root/vendor/bin dirs plus a mocked IO. PHP uses a
@@ -18,7 +16,7 @@ struct SetUp {
root: TempDir,
vendor_dir: String,
bin_dir: String,
- io: Rc<RefCell<dyn IOInterface>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
fs: Filesystem,
}
@@ -37,7 +35,8 @@ fn set_up() -> SetUp {
let bin_dir = format!("{}/bin", root_dir);
fs::create_dir_all(&bin_dir).unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
SetUp {
root,
@@ -94,7 +93,9 @@ fn run_install_and_exec_binary_with_full_compat(contents: &[u8]) {
setup.io.clone(),
setup.bin_dir.clone(),
"full".to_string(),
- Some(Rc::new(RefCell::new(Filesystem::new(None)))),
+ Some(std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(
+ None,
+ )))),
None,
);
installer.install_binaries(package, &pkg_dir, true);
diff --git a/crates/shirabe/tests/installer/installation_manager_test.rs b/crates/shirabe/tests/installer/installation_manager_test.rs
index bc1fcfdc..e3e4c0fc 100644
--- a/crates/shirabe/tests/installer/installation_manager_test.rs
+++ b/crates/shirabe/tests/installer/installation_manager_test.rs
@@ -14,8 +14,6 @@ use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
fn run<F: std::future::Future>(future: F) -> F::Output {
tokio::runtime::Builder::new_current_thread()
@@ -27,17 +25,23 @@ fn run<F: std::future::Future>(future: F) -> F::Output {
/// ref: setUp(): the PHP loop/io mocks are never exercised by these tests (the loop has its
/// constructor disabled), so a real Loop over a real HttpDownloader and a NullIO stand in.
struct SetUp {
- loop_: Rc<RefCell<Loop>>,
- io: Rc<RefCell<dyn IOInterface>>,
+ loop_: std::rc::Rc<std::cell::RefCell<Loop>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
}
fn set_up() -> SetUp {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(shirabe::config::Config::new(false, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(shirabe::config::Config::new(
+ false, None,
+ )));
// The PHP loop mock has its constructor disabled and is never exercised by these tests, so a
// mock HttpDownloader (no real curl backend) stands in.
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(io.clone(), config)));
- let loop_ = Rc::new(RefCell::new(Loop::new(http_downloader, None)));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::__new_mock(
+ io.clone(),
+ config,
+ )));
+ let loop_ = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(http_downloader, None)));
SetUp { loop_, io }
}
@@ -150,12 +154,12 @@ struct BinaryInstallerCalls {
#[derive(Debug)]
struct BinaryInstaller {
- calls: Rc<RefCell<BinaryInstallerCalls>>,
+ calls: std::rc::Rc<std::cell::RefCell<BinaryInstallerCalls>>,
}
impl BinaryInstaller {
- fn new() -> (Self, Rc<RefCell<BinaryInstallerCalls>>) {
- let calls = Rc::new(RefCell::new(BinaryInstallerCalls::default()));
+ fn new() -> (Self, std::rc::Rc<std::cell::RefCell<BinaryInstallerCalls>>) {
+ let calls = std::rc::Rc::new(std::cell::RefCell::new(BinaryInstallerCalls::default()));
(
Self {
calls: calls.clone(),
@@ -262,7 +266,7 @@ fn typed_package(name: &str, version: &str, r#type: &str) -> PackageInterfaceHan
}
fn same_handle(a: &PackageInterfaceHandle, b: &PackageInterfaceHandle) -> bool {
- Rc::ptr_eq(a.as_rc(), b.as_rc())
+ std::rc::Rc::ptr_eq(a.as_rc(), b.as_rc())
}
#[test]
diff --git a/crates/shirabe/tests/installer/installer_event_test.rs b/crates/shirabe/tests/installer/installer_event_test.rs
index b3bf14df..8a8887ab 100644
--- a/crates/shirabe/tests/installer/installer_event_test.rs
+++ b/crates/shirabe/tests/installer/installer_event_test.rs
@@ -6,14 +6,13 @@ use shirabe::event_dispatcher::EventInterface;
use shirabe::installer::InstallerEvent;
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
-use std::cell::RefCell;
-use std::rc::Rc;
#[test]
fn test_getter() {
- let composer_rc = Rc::new(RefCell::new(PartialOrFullComposer::new_full()));
+ let composer_rc = std::rc::Rc::new(std::cell::RefCell::new(PartialOrFullComposer::new_full()));
let composer = ComposerHandle::from_rc_unchecked(composer_rc);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let transaction = Transaction::new(vec![], vec![]);
let event = InstallerEvent::new(
"EVENT_NAME".to_string(),
diff --git a/crates/shirabe/tests/installer/library_installer_test.rs b/crates/shirabe/tests/installer/library_installer_test.rs
index 44c7e5f7..72272a07 100644
--- a/crates/shirabe/tests/installer/library_installer_test.rs
+++ b/crates/shirabe/tests/installer/library_installer_test.rs
@@ -16,9 +16,7 @@ use shirabe::repository::RepositoryInterface;
use shirabe::repository::WritableRepositoryInterface;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
use std::fs;
-use std::rc::Rc;
use tempfile::TempDir;
// PHP mocks `Composer\Downloader\DownloadManager` with getMockBuilder and asserts its
@@ -34,7 +32,7 @@ mockall::mock! {
fn get_downloader_for_package(
&self,
package: PackageInterfaceHandle,
- ) -> anyhow::Result<Option<Rc<RefCell<dyn DownloaderInterface>>>>;
+ ) -> anyhow::Result<Option<std::rc::Rc<std::cell::RefCell<dyn DownloaderInterface>>>>;
async fn download(
&self,
package: PackageInterfaceHandle,
@@ -104,7 +102,7 @@ struct SetUp {
root: TempDir,
vendor_dir: String,
bin_dir: String,
- io: Rc<RefCell<dyn IOInterface>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
composer: PartialComposerWeakHandle,
fs: Filesystem,
composer_full: ComposerHandle,
@@ -116,7 +114,7 @@ fn set_download_manager(setup: &SetUp, dm: MockDownloadManager) {
setup
.composer_full
.borrow_mut()
- .set_download_manager(Rc::new(RefCell::new(dm)));
+ .set_download_manager(std::rc::Rc::new(std::cell::RefCell::new(dm)));
}
fn set_up() -> SetUp {
@@ -144,11 +142,12 @@ fn set_up() -> SetUp {
let mut merged: IndexMap<String, PhpMixed> = IndexMap::new();
merged.insert("config".to_string(), PhpMixed::Array(config_section));
config.merge(&merged, Config::SOURCE_UNKNOWN);
- let config_rc = Rc::new(RefCell::new(config));
+ let config_rc = std::rc::Rc::new(std::cell::RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
- let composer_rc = Rc::new(RefCell::new(PartialOrFullComposer::new_full()));
+ let composer_rc = std::rc::Rc::new(std::cell::RefCell::new(PartialOrFullComposer::new_full()));
let composer = ComposerHandle::from_rc_unchecked(composer_rc.clone());
composer.borrow_mut().set_config(config_rc);
// Default unconfigured mock so LibraryInstaller::new can resolve a DownloadManager even in
@@ -156,7 +155,9 @@ fn set_up() -> SetUp {
// set_download_manager.
composer
.borrow_mut()
- .set_download_manager(Rc::new(RefCell::new(MockDownloadManager::new())));
+ .set_download_manager(std::rc::Rc::new(std::cell::RefCell::new(
+ MockDownloadManager::new(),
+ )));
let weak = PartialComposerHandle::from_rc(composer_rc).downgrade();
@@ -236,7 +237,7 @@ fn test_install() {
dm.expect_install()
.times(1)
.withf_st(move |package, target_dir| {
- Rc::ptr_eq(package.as_rc(), expected_package.as_rc())
+ std::rc::Rc::ptr_eq(package.as_rc(), expected_package.as_rc())
&& target_dir == expected_path.as_str()
})
.returning(|_, _| Ok(None));
@@ -290,8 +291,8 @@ fn test_update() {
dm.expect_update()
.times(1)
.withf_st(move |initial, target, target_dir| {
- Rc::ptr_eq(initial.as_rc(), expected_initial.as_rc())
- && Rc::ptr_eq(target.as_rc(), expected_target.as_rc())
+ std::rc::Rc::ptr_eq(initial.as_rc(), expected_initial.as_rc())
+ && std::rc::Rc::ptr_eq(target.as_rc(), expected_target.as_rc())
&& target_dir == expected_path.as_str()
})
.returning(|_, _, _| Ok(None));
@@ -343,7 +344,7 @@ fn test_uninstall() {
dm.expect_remove()
.times(1)
.withf_st(move |package, target_dir| {
- Rc::ptr_eq(package.as_rc(), expected_package.as_rc())
+ std::rc::Rc::ptr_eq(package.as_rc(), expected_package.as_rc())
&& target_dir == expected_path.as_str()
})
.returning(|_, _| Ok(None));
@@ -426,12 +427,12 @@ fn test_ensure_binaries_installed() {
.expect_install_binaries()
.times(1)
.withf_st(move |package, install_path, warn_on_overwrite| {
- Rc::ptr_eq(package.as_rc(), expected_package.as_rc())
+ std::rc::Rc::ptr_eq(package.as_rc(), expected_package.as_rc())
&& install_path == expected_install_path.as_str()
&& !*warn_on_overwrite
})
.returning(|_, _, _| ());
- library.__set_binary_installer(Rc::new(RefCell::new(binary_installer)));
+ library.__set_binary_installer(std::rc::Rc::new(std::cell::RefCell::new(binary_installer)));
library.ensure_binaries_presence(package.clone());
diff --git a/crates/shirabe/tests/installer/metapackage_installer_test.rs b/crates/shirabe/tests/installer/metapackage_installer_test.rs
index 8528f6a7..bc740e74 100644
--- a/crates/shirabe/tests/installer/metapackage_installer_test.rs
+++ b/crates/shirabe/tests/installer/metapackage_installer_test.rs
@@ -8,8 +8,6 @@ use shirabe::installer::{InstallerInterface, MetapackageInstaller};
use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::repository::{InstalledArrayRepository, RepositoryInterface};
-use std::cell::RefCell;
-use std::rc::Rc;
fn run<F: std::future::Future>(future: F) -> F::Output {
tokio::runtime::Builder::new_current_thread()
@@ -19,7 +17,8 @@ fn run<F: std::future::Future>(future: F) -> F::Output {
}
fn installer() -> MetapackageInstaller {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
MetapackageInstaller::new(io)
}
diff --git a/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs b/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
index 16650853..046e84e4 100644
--- a/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
+++ b/crates/shirabe/tests/installer/suggested_packages_reporter_test.rs
@@ -8,16 +8,18 @@ use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::io::null_io::NullIO;
use shirabe::repository::{InstalledRepository, LockArrayRepository, RepositoryInterfaceHandle};
-use std::cell::RefCell;
-use std::rc::Rc;
/// ref: SuggestedPackagesReporterTest::setUp.
///
/// Builds an IO mock and a SuggestedPackagesReporter sharing it. The IOMockGuard runs
/// assert_complete when it drops at the end of the test scope.
-fn set_up() -> (Rc<RefCell<IOMock>>, SuggestedPackagesReporter, IOMockGuard) {
+fn set_up() -> (
+ std::rc::Rc<std::cell::RefCell<IOMock>>,
+ SuggestedPackagesReporter,
+ IOMockGuard,
+) {
let (mock, guard) = get_io_mock(io_interface::NORMAL).unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = mock.clone();
let reporter = SuggestedPackagesReporter::new(io);
(mock, reporter, guard)
}
@@ -32,7 +34,8 @@ fn get_suggested_package_array() -> IndexMap<String, String> {
}
fn reporter() -> SuggestedPackagesReporter {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
SuggestedPackagesReporter::new(io)
}
diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs
index a38c870a..e5006b86 100644
--- a/crates/shirabe/tests/installer_test.rs
+++ b/crates/shirabe/tests/installer_test.rs
@@ -9,8 +9,6 @@ use config_stub::ConfigStubBuilder;
use test_case::{get_package, get_version_constraint};
use indexmap::IndexMap;
-use std::cell::RefCell;
-use std::rc::Rc;
use shirabe::advisory::{AuditConfig, Auditor};
use shirabe::autoload::{AutoloadGeneratorInterface, ClassLoader};
@@ -83,7 +81,7 @@ impl DownloadManagerInterface for StubDownloadManager {
fn get_downloader_for_package(
&self,
_package: PackageInterfaceHandle,
- ) -> anyhow::Result<Option<Rc<RefCell<dyn DownloaderInterface>>>> {
+ ) -> anyhow::Result<Option<std::rc::Rc<std::cell::RefCell<dyn DownloaderInterface>>>> {
Ok(None)
}
async fn download(
@@ -186,7 +184,7 @@ impl AutoloadGeneratorInterface for StubAutoloadGenerator {
fn set_dry_run(&mut self, _dry_run: bool) {}
fn set_platform_requirement_filter(
&mut self,
- _platform_requirement_filter: Rc<dyn PlatformRequirementFilterInterface>,
+ _platform_requirement_filter: std::rc::Rc<dyn PlatformRequirementFilterInterface>,
) {
}
#[allow(clippy::too_many_arguments)]
@@ -348,10 +346,10 @@ fn test_installer() {
let _tear_down = TearDown;
for case in provide_installer() {
- let io_buffer = Rc::new(RefCell::new(
+ let io_buffer = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), VERBOSITY_NORMAL, None).unwrap(),
));
- let io: Rc<RefCell<dyn IOInterface>> = io_buffer.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_buffer.clone();
let config = ConfigStubBuilder::new()
.with("vendor-dir", PhpMixed::String("foo".to_string()))
@@ -359,13 +357,12 @@ fn test_installer() {
.with("notify-on-install", PhpMixed::Bool(true))
.build_shared();
- let download_manager: Rc<RefCell<dyn DownloadManagerInterface>> =
- Rc::new(RefCell::new(StubDownloadManager));
+ let download_manager: std::rc::Rc<std::cell::RefCell<dyn DownloadManagerInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(StubDownloadManager));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(
- io.clone(),
- config.clone(),
- )));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(
+ HttpDownloader::__new_mock(io.clone(), config.clone()),
+ ));
let mut repository_manager = RepositoryManager::new(
io.clone(),
@@ -380,13 +377,19 @@ fn test_installer() {
for repository in &case.repositories {
repository_manager.add_repository(repository.clone());
}
- let repository_manager: Rc<RefCell<dyn RepositoryManagerInterface>> =
- Rc::new(RefCell::new(repository_manager));
+ let repository_manager: std::rc::Rc<std::cell::RefCell<dyn RepositoryManagerInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(repository_manager));
- let r#loop = Rc::new(RefCell::new(Loop::new(http_downloader.clone(), None)));
- let installation_manager: Rc<RefCell<InstallationManager>> = Rc::new(RefCell::new(
- InstallationManager::__new_mock(r#loop, io.clone(), None),
- ));
+ let r#loop = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(
+ http_downloader.clone(),
+ None,
+ )));
+ let installation_manager: std::rc::Rc<std::cell::RefCell<InstallationManager>> =
+ std::rc::Rc::new(std::cell::RefCell::new(InstallationManager::__new_mock(
+ r#loop,
+ io.clone(),
+ None,
+ )));
// emulate a writable lock file: a real JsonFile over a fresh temp path (initially absent, so
// the installer falls back to an update; PHP uses an in-memory JsonFile mock instead).
@@ -394,17 +397,20 @@ fn test_installer() {
let lock_path = lock_dir.path().join("composer.lock");
let lock_json =
JsonFile::new(lock_path.to_string_lossy().into_owned(), None, None).unwrap();
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
- let locker: Rc<RefCell<dyn LockerInterface>> = Rc::new(RefCell::new(Locker::new(
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
io.clone(),
- lock_json,
- installation_manager.clone(),
- "{}",
- process,
- )));
+ ))));
+ let locker: std::rc::Rc<std::cell::RefCell<dyn LockerInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(Locker::new(
+ io.clone(),
+ lock_json,
+ installation_manager.clone(),
+ "{}",
+ process,
+ )));
- let autoload_generator: Rc<RefCell<dyn AutoloadGeneratorInterface>> =
- Rc::new(RefCell::new(StubAutoloadGenerator));
+ let autoload_generator: std::rc::Rc<std::cell::RefCell<dyn AutoloadGeneratorInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(StubAutoloadGenerator));
let root_package: RootPackageInterfaceHandle =
RootPackageInterfaceHandle::dup(&case.root_package.clone().into());
@@ -416,7 +422,7 @@ fn test_installer() {
repository_manager,
locker,
installation_manager.clone(),
- Rc::new(RefCell::new(StubEventDispatcher)),
+ std::rc::Rc::new(std::cell::RefCell::new(StubEventDispatcher)),
autoload_generator,
);
installer.set_audit_config(
@@ -790,10 +796,10 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) {
return; // markTestSkipped
}
- let io_buffer = Rc::new(RefCell::new(
+ let io_buffer = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), VERBOSITY_NORMAL, None).unwrap(),
));
- let io: Rc<RefCell<dyn IOInterface>> = io_buffer.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_buffer.clone();
let is_exception = matches!(case.expect_result, ExpectResult::Exception(_));
@@ -845,9 +851,11 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) {
// The Locker needs a concrete InstallationManager; build a fresh recording mock just for it. The
// asserted trace comes from the composer's own installation manager (read via as_any below).
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
let locker_loop = composer.borrow().get_loop();
- let locker_im = Rc::new(RefCell::new(InstallationManager::__new_mock(
+ let locker_im = std::rc::Rc::new(std::cell::RefCell::new(InstallationManager::__new_mock(
locker_loop,
io.clone(),
None,
@@ -856,16 +864,20 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) {
let locker = Locker::new(io.clone(), lock_json, locker_im, &contents, process);
composer
.borrow_mut()
- .set_locker(Rc::new(RefCell::new(locker)));
+ .set_locker(std::rc::Rc::new(std::cell::RefCell::new(locker)));
composer
.borrow_mut()
- .set_autoload_generator(Rc::new(RefCell::new(StubAutoloadGenerator)));
+ .set_autoload_generator(std::rc::Rc::new(std::cell::RefCell::new(
+ StubAutoloadGenerator,
+ )));
composer
.borrow_mut()
- .set_event_dispatcher(Rc::new(RefCell::new(StubEventDispatcher)));
+ .set_event_dispatcher(std::rc::Rc::new(std::cell::RefCell::new(
+ StubEventDispatcher,
+ )));
- let installer = Rc::new(RefCell::new(Installer::create(
+ let installer = std::rc::Rc::new(std::cell::RefCell::new(Installer::create(
io.clone(),
&composer.upcast(),
)));
@@ -874,9 +886,12 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) {
let application = ApplicationHandle::new("Composer".to_string(), "".to_string()).unwrap();
application.set_catch_exceptions(false);
- let run_result: Rc<RefCell<Option<anyhow::Result<i64>>>> = Rc::new(RefCell::new(None));
+ let run_result: std::rc::Rc<std::cell::RefCell<Option<anyhow::Result<i64>>>> =
+ std::rc::Rc::new(std::cell::RefCell::new(None));
- let install = Rc::new(RefCell::new(CommandData::new(Some("install".to_string()))));
+ let install = std::rc::Rc::new(std::cell::RefCell::new(CommandData::new(Some(
+ "install".to_string(),
+ ))));
{
let install_ref = install.borrow();
install_ref
@@ -944,10 +959,12 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) {
}));
}
application
- .add(install.clone() as Rc<RefCell<dyn SymfonyCommand>>)
+ .add(install.clone() as std::rc::Rc<std::cell::RefCell<dyn SymfonyCommand>>)
.unwrap();
- let update = Rc::new(RefCell::new(CommandData::new(Some("update".to_string()))));
+ let update = std::rc::Rc::new(std::cell::RefCell::new(CommandData::new(Some(
+ "update".to_string(),
+ ))));
{
let update_ref = update.borrow();
for (name, mode) in [
@@ -1045,7 +1062,7 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) {
}));
}
application
- .add(update.clone() as Rc<RefCell<dyn SymfonyCommand>>)
+ .add(update.clone() as std::rc::Rc<std::cell::RefCell<dyn SymfonyCommand>>)
.unwrap();
assert!(
@@ -1059,8 +1076,10 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) {
.expect("php://memory is a valid stream");
let mut string_input = StringInput::new(&format!("{} -vvv", case.run)).unwrap();
string_input.set_interactive(false);
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(string_input));
- let output: Rc<RefCell<dyn OutputInterface>> = Rc::new(RefCell::new(app_output));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(string_input));
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(app_output));
let app_run = application.run(Some(input), Some(output));
diff --git a/crates/shirabe/tests/io/console_io_test.rs b/crates/shirabe/tests/io/console_io_test.rs
index 9df851ec..62cb8322 100644
--- a/crates/shirabe/tests/io/console_io_test.rs
+++ b/crates/shirabe/tests/io/console_io_test.rs
@@ -23,17 +23,17 @@ use shirabe_external_packages::symfony::console::input::streamable_input_interfa
use shirabe_external_packages::symfony::console::output::buffered_output::BufferedOutput;
use shirabe_external_packages::symfony::console::output::output_interface::OutputInterface;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
/// Builds a ConsoleIO backed by real, side-effect-free Input/Output/QuestionHelper. PHP uses
/// PHPUnit mocks here, but for tests that exercise only the authentication map they carry no
/// expectations, so concrete implementations are an exact substitute.
fn make_console_io() -> ConsoleIO {
- let input: Rc<RefCell<dyn InputInterface>> =
- Rc::new(RefCell::new(ArrayInput::new(vec![], None).unwrap()));
- let output: Rc<RefCell<dyn OutputInterface>> =
- Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(ArrayInput::new(vec![], None).unwrap()),
+ );
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(BufferedOutput::new(None, false, None)),
+ );
ConsoleIO::new(input, output, QuestionHelper::default())
}
@@ -49,12 +49,17 @@ fn get_input_stream(input: &str) -> shirabe_php_shim::PhpResource {
/// Builds a ConsoleIO whose interactive input stream yields `answer`, plus a handle on the
/// `BufferedOutput` so the prompt can be inspected. The input is an `ArrayInput` (interactive by
/// default) with the answer stream attached, exactly as the question-helper tests set things up.
-fn make_console_io_with_answer(answer: &str) -> (ConsoleIO, Rc<RefCell<BufferedOutput>>) {
+fn make_console_io_with_answer(
+ answer: &str,
+) -> (ConsoleIO, std::rc::Rc<std::cell::RefCell<BufferedOutput>>) {
let mut array_input = ArrayInput::new(vec![], None).unwrap();
array_input.set_stream(get_input_stream(answer));
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(array_input));
- let buffered = Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
- let output: Rc<RefCell<dyn OutputInterface>> = buffered.clone();
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(array_input));
+ let buffered = std::rc::Rc::new(std::cell::RefCell::new(BufferedOutput::new(
+ None, false, None,
+ )));
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = buffered.clone();
(
ConsoleIO::new(input, output, QuestionHelper::default()),
buffered,
@@ -66,9 +71,11 @@ fn test_is_interactive() {
// PHP mocks isInteractive to return true then false on consecutive calls. A real ArrayInput
// exposes a mutable interactive flag, so toggling it between the two asserts is equivalent.
let array_input = ArrayInput::new(vec![], None).unwrap();
- let input: Rc<RefCell<dyn InputInterface>> = Rc::new(RefCell::new(array_input));
- let output: Rc<RefCell<dyn OutputInterface>> =
- Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(array_input));
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(BufferedOutput::new(None, false, None)),
+ );
let console_io = ConsoleIO::new(input.clone(), output, QuestionHelper::default());
input.borrow_mut().set_interactive(true);
@@ -82,10 +89,13 @@ fn test_write() {
// PHP: expects write('some information about something', false) at VERBOSITY_NORMAL.
// A plain (non-Console) OutputInterface routes write to the main output, so the message lands
// in the BufferedOutput verbatim (no trailing EOL since newline is false).
- let input: Rc<RefCell<dyn InputInterface>> =
- Rc::new(RefCell::new(ArrayInput::new(vec![], None).unwrap()));
- let buffered = Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
- let output: Rc<RefCell<dyn OutputInterface>> = buffered.clone();
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(ArrayInput::new(vec![], None).unwrap()),
+ );
+ let buffered = std::rc::Rc::new(std::cell::RefCell::new(BufferedOutput::new(
+ None, false, None,
+ )));
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = buffered.clone();
let console_io = ConsoleIO::new(input, output, QuestionHelper::default());
console_io.write3("some information about something", false, NORMAL);
@@ -123,10 +133,13 @@ fn test_overwrite() {
// "\x08" * 12 (clear previous, len = 12)
// 'something longer than initial (34)' (new message)
// The final overwrite needs no fill and newline defaults true, appending a trailing "\n".
- let input: Rc<RefCell<dyn InputInterface>> =
- Rc::new(RefCell::new(ArrayInput::new(vec![], None).unwrap()));
- let buffered = Rc::new(RefCell::new(BufferedOutput::new(None, false, None)));
- let output: Rc<RefCell<dyn OutputInterface>> = buffered.clone();
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(ArrayInput::new(vec![], None).unwrap()),
+ );
+ let buffered = std::rc::Rc::new(std::cell::RefCell::new(BufferedOutput::new(
+ None, false, None,
+ )));
+ let output: std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> = buffered.clone();
let console_io = ConsoleIO::new(input, output, QuestionHelper::default());
console_io.write3("something (<question>strlen = 23</question>)", true, NORMAL);
diff --git a/crates/shirabe/tests/package/archiver/archive_manager_test.rs b/crates/shirabe/tests/package/archiver/archive_manager_test.rs
index b275692b..4f28b468 100644
--- a/crates/shirabe/tests/package/archiver/archive_manager_test.rs
+++ b/crates/shirabe/tests/package/archiver/archive_manager_test.rs
@@ -16,8 +16,6 @@ use shirabe_external_packages::symfony::process::Process;
use shirabe_php_shim::{
PhpMixed, file_exists, file_put_contents, realpath, sys_get_temp_dir, unlink,
};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
// ref: ArchiverTestCase::setUp + ArchiveManagerTest::setUp.
@@ -36,30 +34,34 @@ impl TestCase {
let guard = TempDir::new().unwrap();
let test_dir = guard.path().to_string_lossy().to_string();
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(false, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
// The filename/unknown-format tests never drive the download path, so a mock
// HttpDownloader (no curl backend) is sufficient to satisfy Loop's dependency.
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(
+ HttpDownloader::__new_mock(io.clone(), config.clone()),
+ ));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
io.clone(),
- config.clone(),
- )));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
- let fs = Rc::new(RefCell::new(Filesystem::new(Some(process.clone()))));
+ ))));
+ let fs = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(Some(
+ process.clone(),
+ ))));
let mut dm = DownloadManager::new(io.clone(), false, Some(fs.clone()));
// Factory::createDownloadManager registers a git downloader; the archive tests clone the
// package source (source type 'git') through it.
dm.set_downloader(
"git",
- Rc::new(RefCell::new(GitDownloader::new(
+ std::rc::Rc::new(std::cell::RefCell::new(GitDownloader::new(
io.clone(),
config.clone(),
Some(process.clone()),
Some(fs.clone()),
))),
);
- let dm = Rc::new(RefCell::new(dm));
- let r#loop = Rc::new(RefCell::new(Loop::new(http_downloader, None)));
+ let dm = std::rc::Rc::new(std::cell::RefCell::new(dm));
+ let r#loop = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(http_downloader, None)));
let mut manager = ArchiveManager::new(dm, r#loop);
manager.add_archiver(Box::new(ZipArchiver::new()));
diff --git a/crates/shirabe/tests/package/loader/root_package_loader_test.rs b/crates/shirabe/tests/package/loader/root_package_loader_test.rs
index 6a13736d..069cf5a7 100644
--- a/crates/shirabe/tests/package/loader/root_package_loader_test.rs
+++ b/crates/shirabe/tests/package/loader/root_package_loader_test.rs
@@ -21,18 +21,16 @@ use shirabe::util::Git as GitUtil;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(NullIO::new()))
+fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))
}
fn http_downloader(
- io: &Rc<RefCell<dyn IOInterface>>,
- config: &Rc<RefCell<Config>>,
-) -> Rc<RefCell<HttpDownloader>> {
- Rc::new(RefCell::new(HttpDownloader::new(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: &std::rc::Rc<std::cell::RefCell<Config>>,
+) -> std::rc::Rc<std::cell::RefCell<HttpDownloader>> {
+ std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config.clone(),
IndexMap::new(),
@@ -41,8 +39,8 @@ fn http_downloader(
}
// `$config = new Config; $config->merge(['repositories' => ['packagist' => false]]);`
-fn make_config() -> Rc<RefCell<Config>> {
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+fn make_config() -> std::rc::Rc<std::cell::RefCell<Config>> {
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
let mut repositories: IndexMap<String, PhpMixed> = IndexMap::new();
repositories.insert("packagist".to_string(), PhpMixed::Bool(false));
let mut merge: IndexMap<String, PhpMixed> = IndexMap::new();
@@ -54,10 +52,10 @@ fn make_config() -> Rc<RefCell<Config>> {
// Stands in for `getMockBuilder('Composer\Repository\RepositoryManager')->disableOriginalConstructor()`.
// The loader only stores it and feeds it default repositories, so a real instance suffices.
fn make_manager(
- io: &Rc<RefCell<dyn IOInterface>>,
- config: &Rc<RefCell<Config>>,
-) -> Rc<RefCell<RepositoryManager>> {
- Rc::new(RefCell::new(RepositoryManager::new(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: &std::rc::Rc<std::cell::RefCell<Config>>,
+) -> std::rc::Rc<std::cell::RefCell<RepositoryManager>> {
+ std::rc::Rc::new(std::cell::RefCell::new(RepositoryManager::new(
io.clone(),
config.clone(),
http_downloader(io, config),
@@ -103,7 +101,7 @@ mockall::mock! {
#[ignore = "process_executor.enable_async() drives the async stream path, which calls stream_set_blocking (fcntl(2) todo!() in shirabe-php-shim::stream)"]
fn test_stability_flags_parsing() {
let io = null_io();
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
{
let mut cfg = IndexMap::new();
cfg.insert(
@@ -117,7 +115,7 @@ fn test_stability_flags_parsing() {
config.borrow_mut().merge(&cfg, "test");
}
- let manager = Rc::new(RefCell::new(RepositoryManager::new(
+ let manager = std::rc::Rc::new(std::cell::RefCell::new(RepositoryManager::new(
io.clone(),
config.clone(),
http_downloader(&io, &config),
@@ -129,7 +127,7 @@ fn test_stability_flags_parsing() {
process_executor.enable_async();
let guesser = VersionGuesser::new(
config.clone(),
- Rc::new(RefCell::new(process_executor)),
+ std::rc::Rc::new(std::cell::RefCell::new(process_executor)),
VersionParser::new(),
Some(io.clone()),
);
diff --git a/crates/shirabe/tests/package/locker_test.rs b/crates/shirabe/tests/package/locker_test.rs
index bbc333e7..fc66293b 100644
--- a/crates/shirabe/tests/package/locker_test.rs
+++ b/crates/shirabe/tests/package/locker_test.rs
@@ -14,21 +14,24 @@ use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe::util::process_executor::ProcessExecutor;
use shirabe_php_shim::{LogicException, PhpMixed, hash};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(NullIO::new()))
+fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))
}
-fn installation_manager(io: &Rc<RefCell<dyn IOInterface>>) -> Rc<RefCell<InstallationManager>> {
+fn installation_manager(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+) -> std::rc::Rc<std::cell::RefCell<InstallationManager>> {
// These tests never reach Locker::get_package_time, so the InstallationManager is never
// actually used; build it over a mock HttpDownloader to avoid the unimplemented curl backend.
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::__new_mock(io.clone(), config)));
- let r#loop = Rc::new(RefCell::new(Loop::new(http_downloader, None)));
- Rc::new(RefCell::new(InstallationManager::new(
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::__new_mock(
+ io.clone(),
+ config,
+ )));
+ let r#loop = std::rc::Rc::new(std::cell::RefCell::new(Loop::new(http_downloader, None)));
+ std::rc::Rc::new(std::cell::RefCell::new(InstallationManager::new(
r#loop,
io.clone(),
None,
@@ -57,7 +60,11 @@ fn get_json_content(custom_data: &[(&str, &str)]) -> String {
fn make_locker(
json_content: &str,
lock_contents: Option<&str>,
-) -> (Locker, TempDir, Rc<RefCell<dyn IOInterface>>) {
+) -> (
+ Locker,
+ TempDir,
+ std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+) {
let temp_dir = TempDir::new().unwrap();
let lock_path = temp_dir.path().join("composer.lock");
if let Some(contents) = lock_contents {
@@ -66,7 +73,9 @@ fn make_locker(
let io = null_io();
let json_file = JsonFile::new(lock_path.to_string_lossy().into_owned(), None, None).unwrap();
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
let locker = Locker::new(
io.clone(),
json_file,
diff --git a/crates/shirabe/tests/package/version/version_guesser_test.rs b/crates/shirabe/tests/package/version/version_guesser_test.rs
index 1a3f23c1..92d5e90b 100644
--- a/crates/shirabe/tests/package/version/version_guesser_test.rs
+++ b/crates/shirabe/tests/package/version/version_guesser_test.rs
@@ -9,8 +9,6 @@ use shirabe::util::Git as GitUtil;
use shirabe::util::platform::Platform;
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
// Mirrors VersionGuesserTest::setUp/tearDown: reset GitUtil's cached `version`
// static so each test re-runs `git --version` against its own mock.
@@ -27,19 +25,19 @@ impl Drop for TearDown {
}
// `$config = new Config; $config->merge(['repositories' => ['packagist' => false]]);`
-fn make_config() -> Rc<RefCell<Config>> {
+fn make_config() -> std::rc::Rc<std::cell::RefCell<Config>> {
let mut config = Config::new(true, None);
let mut repositories: IndexMap<String, PhpMixed> = IndexMap::new();
repositories.insert("packagist".to_string(), PhpMixed::Bool(false));
let mut merge: IndexMap<String, PhpMixed> = IndexMap::new();
merge.insert("repositories".to_string(), PhpMixed::Array(repositories));
config.merge(&merge, Config::SOURCE_UNKNOWN);
- Rc::new(RefCell::new(config))
+ std::rc::Rc::new(std::cell::RefCell::new(config))
}
fn make_guesser(
- config: Rc<RefCell<Config>>,
- process: Rc<RefCell<ProcessExecutor>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
) -> VersionGuesser {
VersionGuesser::new(config, process, VersionParser::new(), None)
}
@@ -615,8 +613,8 @@ fn test_get_root_version_from_env() {
for (env, expected_version) in root_env_versions {
Platform::put_env("COMPOSER_ROOT_VERSION", env);
- let config = Rc::new(RefCell::new(Config::new(true, None)));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let guesser = VersionGuesser::new(config, process, VersionParser::new(), None);
assert_eq!(
expected_version,
diff --git a/crates/shirabe/tests/package/version/version_selector_test.rs b/crates/shirabe/tests/package/version/version_selector_test.rs
index 3a0c7019..70874bcb 100644
--- a/crates/shirabe/tests/package/version/version_selector_test.rs
+++ b/crates/shirabe/tests/package/version/version_selector_test.rs
@@ -19,8 +19,6 @@ use shirabe_external_packages::symfony::console::output::output_interface;
use shirabe_php_shim::PhpMixed;
use shirabe_php_shim::{PHP_MAJOR_VERSION, PHP_MINOR_VERSION, PHP_RELEASE_VERSION};
use shirabe_semver::constraint::AnyConstraint;
-use std::cell::RefCell;
-use std::rc::Rc;
mockall::mock! {
RepositorySet {}
@@ -41,8 +39,10 @@ impl std::fmt::Debug for MockRepositorySet {
}
}
-fn into_seam(mock: MockRepositorySet) -> Rc<RefCell<dyn RepositorySetInterface>> {
- Rc::new(RefCell::new(mock))
+fn into_seam(
+ mock: MockRepositorySet,
+) -> std::rc::Rc<std::cell::RefCell<dyn RepositorySetInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(mock))
}
/// Mirrors PHPUnit `assertSame($expected, $best)`: object identity, not value equality.
@@ -77,7 +77,7 @@ fn find_best(
dyn shirabe::filter::platform_requirement_filter::PlatformRequirementFilterInterface,
>,
>,
- io: Option<Rc<RefCell<dyn IOInterface>>>,
+ io: Option<std::rc::Rc<std::cell::RefCell<dyn IOInterface>>>,
) -> Option<PackageInterfaceHandle> {
version_selector
.find_best_candidate(
@@ -159,10 +159,10 @@ fn test_latest_version_is_returned_that_matches_php_requirements() {
let mut version_selector =
VersionSelector::new(into_seam(repository_set), Some(&mut platform)).unwrap();
- let io = Rc::new(RefCell::new(
+ let io = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), output_interface::VERBOSITY_NORMAL, None).unwrap(),
));
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io.clone();
let best = find_best(
&mut version_selector,
package_name,
@@ -180,10 +180,10 @@ fn test_latest_version_is_returned_that_matches_php_requirements() {
io.borrow().get_output()
);
- let io = Rc::new(RefCell::new(
+ let io = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), output_interface::VERBOSITY_VERBOSE, None).unwrap(),
));
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io.clone();
let best = find_best(
&mut version_selector,
package_name,
diff --git a/crates/shirabe/tests/question/strict_confirmation_question_test.rs b/crates/shirabe/tests/question/strict_confirmation_question_test.rs
index d8606ebe..37d57117 100644
--- a/crates/shirabe/tests/question/strict_confirmation_question_test.rs
+++ b/crates/shirabe/tests/question/strict_confirmation_question_test.rs
@@ -7,8 +7,6 @@ use shirabe_external_packages::symfony::console::input::streamable_input_interfa
use shirabe_external_packages::symfony::console::output::output_interface::OutputInterface;
use shirabe_external_packages::symfony::console::output::stream_output::StreamOutput;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
const TRUE_ANSWER_REGEX: &str = "/^y(?:es)?$/i";
const FALSE_ANSWER_REGEX: &str = "/^no?$/i";
@@ -111,12 +109,12 @@ fn get_input_stream(input: &str) -> shirabe_php_shim::PhpResource {
stream
}
-fn create_output_interface() -> Rc<RefCell<dyn OutputInterface>> {
+fn create_output_interface() -> std::rc::Rc<std::cell::RefCell<dyn OutputInterface>> {
let stream = shirabe_php_shim::php_fopen_resource("php://memory", "r+");
let output = StreamOutput::new(stream, None, None, None)
.unwrap()
.expect("php://memory is a valid stream");
- Rc::new(RefCell::new(output))
+ std::rc::Rc::new(std::cell::RefCell::new(output))
}
/// @return array{ArrayInput, QuestionHelper}
diff --git a/crates/shirabe/tests/repository/artifact_repository_test.rs b/crates/shirabe/tests/repository/artifact_repository_test.rs
index 558ee8b1..2bfe85de 100644
--- a/crates/shirabe/tests/repository/artifact_repository_test.rs
+++ b/crates/shirabe/tests/repository/artifact_repository_test.rs
@@ -4,8 +4,6 @@ use indexmap::IndexMap;
use shirabe::io::{IOInterface, NullIO};
use shirabe::repository::ArtifactRepository;
use shirabe_php_shim::{PhpMixed, extension_loaded};
-use std::cell::RefCell;
-use std::rc::Rc;
/// Returns true when the test should be skipped because the zip extension is
/// unavailable, mirroring PHP's markTestSkipped in setUp.
@@ -29,7 +27,8 @@ fn create_repo(url: &str) -> ArtifactRepository {
coordinates.insert("type".to_string(), PhpMixed::String("artifact".to_string()));
coordinates.insert("url".to_string(), PhpMixed::String(url.to_string()));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
ArtifactRepository::new(coordinates, io).unwrap()
}
diff --git a/crates/shirabe/tests/repository/composer_repository_test.rs b/crates/shirabe/tests/repository/composer_repository_test.rs
index 8e5a7f12..613dbb8e 100644
--- a/crates/shirabe/tests/repository/composer_repository_test.rs
+++ b/crates/shirabe/tests/repository/composer_repository_test.rs
@@ -11,8 +11,6 @@ use shirabe::repository::composer_repository::{ComposerRepository, ProviderListi
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::constraint::{AnyConstraint, SimpleConstraint};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
// Mirrors PHP's `['url' => .., 'body' => ..]` mock entry (status defaults to 200,
@@ -53,8 +51,8 @@ fn create_config_read_only() -> (Config, TempDir) {
(config, home)
}
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(NullIO::new()))
+fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))
}
fn repo_config(url: &str) -> IndexMap<String, PhpMixed> {
@@ -250,9 +248,9 @@ fn test_what_provides() {
)
.unwrap();
- let rc = Rc::new(RefCell::new(repo));
- let rc_dyn: Rc<RefCell<dyn RepositoryInterface>> = rc.clone();
- rc.borrow().set_self_handle(Rc::downgrade(&rc_dyn));
+ let rc = std::rc::Rc::new(std::cell::RefCell::new(repo));
+ let rc_dyn: std::rc::Rc<std::cell::RefCell<dyn RepositoryInterface>> = rc.clone();
+ rc.borrow().set_self_handle(std::rc::Rc::downgrade(&rc_dyn));
let mut provider_listing: IndexMap<String, ProviderListingEntry> = IndexMap::new();
provider_listing.insert("a".to_string(), ProviderListingEntry { sha256 });
diff --git a/crates/shirabe/tests/repository/filesystem_repository_test.rs b/crates/shirabe/tests/repository/filesystem_repository_test.rs
index e8bdddb2..f9d03ecd 100644
--- a/crates/shirabe/tests/repository/filesystem_repository_test.rs
+++ b/crates/shirabe/tests/repository/filesystem_repository_test.rs
@@ -15,8 +15,6 @@ use shirabe::repository::filesystem_repository::FilesystemRepository;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
use shirabe_semver::VersionParser;
-use std::cell::RefCell;
-use std::rc::Rc;
/// PHP mocks JsonFile::read()/exists(); without a mocking framework the canned read value is
/// materialized as a real temp file whose decoded JSON reproduces the mock return value exactly.
@@ -107,14 +105,14 @@ mockall::mock! {
fn execute(
&mut self,
repo: &mut dyn InstalledRepositoryInterface,
- operations: Vec<Rc<dyn OperationInterface>>,
+ operations: Vec<std::rc::Rc<dyn OperationInterface>>,
dev_mode: bool,
run_scripts: bool,
download_only: bool,
) -> anyhow::Result<()>;
fn get_install_path(&mut self, package: PackageInterfaceHandle) -> Option<String>;
fn set_output_progress(&mut self, output_progress: bool);
- fn notify_installs(&mut self, io: Rc<RefCell<dyn IOInterface>>);
+ fn notify_installs(&mut self, io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>);
}
}
diff --git a/crates/shirabe/tests/repository/path_repository_test.rs b/crates/shirabe/tests/repository/path_repository_test.rs
index f86d659d..1cd034d2 100644
--- a/crates/shirabe/tests/repository/path_repository_test.rs
+++ b/crates/shirabe/tests/repository/path_repository_test.rs
@@ -11,8 +11,6 @@ use shirabe::util::{Platform, ProcessExecutor};
use shirabe_php_shim::{
DIRECTORY_SEPARATOR, PhpMixed, file_get_contents, hash, realpath, serialize,
};
-use std::cell::RefCell;
-use std::rc::Rc;
fn fixtures_dir() -> String {
format!(
@@ -23,14 +21,15 @@ fn fixtures_dir() -> String {
/// ref: PathRepositoryTest::createPathRepo
fn create_path_repo(options: IndexMap<String, PhpMixed>) -> PathRepository {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
- let proc = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
+ let proc = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
// ref: createPathRepo wires the ProcessExecutor through a Loop so the VersionGuesser's async
// git calls are permitted; constructing the Loop calls enable_async() on the shared executor.
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::new(
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config.clone(),
IndexMap::new(),
diff --git a/crates/shirabe/tests/repository/repository_factory_test.rs b/crates/shirabe/tests/repository/repository_factory_test.rs
index ef523808..287e7a4e 100644
--- a/crates/shirabe/tests/repository/repository_factory_test.rs
+++ b/crates/shirabe/tests/repository/repository_factory_test.rs
@@ -7,14 +7,13 @@ use shirabe::io::null_io::NullIO;
use shirabe::repository::RepositoryFactory;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
#[test]
fn test_manager_with_all_repository_types() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::new(
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config.clone(),
IndexMap::new(),
diff --git a/crates/shirabe/tests/repository/repository_manager_test.rs b/crates/shirabe/tests/repository/repository_manager_test.rs
index c67cec49..2eac5265 100644
--- a/crates/shirabe/tests/repository/repository_manager_test.rs
+++ b/crates/shirabe/tests/repository/repository_manager_test.rs
@@ -14,8 +14,6 @@ use shirabe::repository::{
use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -50,13 +48,15 @@ impl Drop for TearDown {
}
}
-fn null_io() -> Rc<RefCell<dyn IOInterface>> {
- Rc::new(RefCell::new(NullIO::new()))
+fn null_io() -> std::rc::Rc<std::cell::RefCell<dyn IOInterface>> {
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()))
}
-fn http_downloader(io: &Rc<RefCell<dyn IOInterface>>) -> Rc<RefCell<HttpDownloader>> {
- let config = Rc::new(RefCell::new(Config::new(false, None)));
- Rc::new(RefCell::new(HttpDownloader::new(
+fn http_downloader(
+ io: &std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+) -> std::rc::Rc<std::cell::RefCell<HttpDownloader>> {
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
+ std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config,
IndexMap::new(),
@@ -78,7 +78,7 @@ fn test_prepend() {
let _tear_down = TearDown::new(tmpdir.path().to_path_buf());
let io = null_io();
- let config = Rc::new(RefCell::new(Config::new(false, None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
let mut rm = RepositoryManager::new(io.clone(), config, http_downloader(&io), None, None);
let repository1 = RepositoryInterfaceHandle::new(ArrayRepository::new(vec![]).unwrap());
@@ -96,7 +96,7 @@ fn test_repo_creation() {
let _tear_down = TearDown::new(tmpdir.path().to_path_buf());
let io = null_io();
- let config = Rc::new(RefCell::new(Config::new(false, None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
let mut rm =
RepositoryManager::new(io.clone(), config.clone(), http_downloader(&io), None, None);
@@ -181,7 +181,7 @@ fn test_invalid_repo_creation_throws() {
let _tear_down = TearDown::new(tmpdir.path().to_path_buf());
let io = null_io();
- let config = Rc::new(RefCell::new(Config::new(false, None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
let rm = RepositoryManager::new(io.clone(), config.clone(), http_downloader(&io), None, None);
config.borrow_mut().merge(
@@ -217,7 +217,7 @@ fn test_filter_repo_wrapping() {
let _tear_down = TearDown::new(tmpdir.path().to_path_buf());
let io = null_io();
- let config = Rc::new(RefCell::new(Config::new(false, None)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(false, None)));
let mut rm = RepositoryManager::new(io.clone(), config, http_downloader(&io), None, None);
rm.set_repository_class("path", "Composer\\Repository\\PathRepository");
diff --git a/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs b/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
index 296309f4..d9138b0c 100644
--- a/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/forgejo_driver_test.rs
@@ -11,14 +11,12 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
home: TempDir,
- config: Rc<RefCell<Config>>,
- io: Rc<RefCell<dyn IOInterface>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
}
fn set_up() -> SetUp {
@@ -39,11 +37,12 @@ fn set_up() -> SetUp {
// PHP mocks IOInterface with isInteractive() => true; on the passing (200) paths
// exercised here the interactivity flag is never consulted, so a bare NullIO matches.
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
SetUp {
home,
- config: Rc::new(RefCell::new(config)),
+ config: std::rc::Rc::new(std::cell::RefCell::new(config)),
io,
}
}
@@ -73,7 +72,7 @@ impl Drop for TearDown {
fn initialize_driver(
set_up: &SetUp,
repo_url: &str,
- http_downloader: Rc<RefCell<HttpDownloader>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
) -> (ForgejoDriver, ProcessExecutorMockGuard) {
let (process, process_guard) = get_process_executor_mock(vec![], false, MockHandler::default());
@@ -93,7 +92,10 @@ fn initialize_driver(
fn http_mock(
expectations: Vec<shirabe::util::http_downloader::HttpDownloaderMockExpectation>,
-) -> (Rc<RefCell<HttpDownloader>>, HttpDownloaderMockGuard) {
+) -> (
+ std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
+ HttpDownloaderMockGuard,
+) {
get_http_downloader_mock(expectations, true, HttpDownloaderMockHandler::default())
}
diff --git a/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs b/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs
index 1a5a4256..77c1f130 100644
--- a/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/fossil_driver_test.rs
@@ -7,8 +7,6 @@ use shirabe::io::null_io::NullIO;
use shirabe::repository::vcs::FossilDriver;
use shirabe::util::filesystem::Filesystem;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -66,8 +64,9 @@ fn support_provider() -> Vec<(&'static str, bool)> {
#[test]
fn test_support() {
for (url, assertion) in support_provider() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
let result = FossilDriver::supports(io, config, url, false).unwrap();
assert_eq!(assertion, result);
}
diff --git a/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs b/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
index 124d5291..4d84bcf2 100644
--- a/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/git_bitbucket_driver_test.rs
@@ -11,8 +11,6 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe::util::process_executor::ProcessExecutor;
use shirabe_php_shim::{InvalidArgumentException, PhpMixed, RuntimeException};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -70,14 +68,16 @@ fn http_body(
// then calls initialize().
fn get_driver(
url: &str,
- io: Rc<RefCell<dyn IOInterface>>,
- config: Rc<RefCell<Config>>,
- http_downloader: Rc<RefCell<HttpDownloader>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
) -> anyhow::Result<GitBitbucketDriver> {
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(url.to_string()));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
let mut driver = GitBitbucketDriver::new(repo_config, io, config, http_downloader, process);
driver.initialize()?;
@@ -89,8 +89,9 @@ fn test_get_root_identifier_wrong_scm_type() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) = get_http_downloader_mock(
vec![http_body(
@@ -124,8 +125,9 @@ fn test_driver() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let urls = [
"https://api.bitbucket.org/2.0/repositories/user/repo?fields=-project%2C-owner",
@@ -238,8 +240,9 @@ fn test_initialize_invalid_repository_url() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard) =
get_http_downloader_mock(vec![], true, HttpDownloaderMockHandler::default());
@@ -257,8 +260,9 @@ fn test_invalid_support_data() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let repo_url = "https://bitbucket.org/user/repo.git";
@@ -306,8 +310,9 @@ fn test_invalid_support_data() {
#[test]
fn test_supports() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
assert!(
GitBitbucketDriver::supports(
diff --git a/crates/shirabe/tests/repository/vcs/git_driver_test.rs b/crates/shirabe/tests/repository/vcs/git_driver_test.rs
index be26dd1d..7a85d4cc 100644
--- a/crates/shirabe/tests/repository/vcs/git_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/git_driver_test.rs
@@ -13,8 +13,6 @@ use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::platform::Platform;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::{PhpMixed, RuntimeException};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -80,8 +78,9 @@ fn test_get_root_identifier_from_remote_local_repository() {
let home_path = home.path().to_string_lossy().into_owned();
let _tear_down = TearDown::new(home.path().to_path_buf(), network_env);
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
@@ -114,8 +113,9 @@ fn test_get_root_identifier_from_remote() {
let home_path = home.path().to_string_lossy().into_owned();
let _tear_down = TearDown::new(home.path().to_path_buf(), network_env);
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
@@ -182,8 +182,9 @@ fn test_get_root_identifier_from_local_with_network_disabled() {
Platform::put_env("COMPOSER_DISABLE_NETWORK", "1");
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
@@ -218,8 +219,9 @@ fn test_get_branches_filter_invalid_branch_names() {
let home_path = home.path().to_string_lossy().into_owned();
let _tear_down = TearDown::new(home.path().to_path_buf(), network_env);
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
@@ -270,8 +272,9 @@ fn test_file_get_content_invalid_identifier() {
} = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf(), network_env);
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
@@ -302,8 +305,9 @@ fn test_get_change_date_invalid_identifier() {
} = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf(), network_env);
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
diff --git a/crates/shirabe/tests/repository/vcs/github_driver_test.rs b/crates/shirabe/tests/repository/vcs/github_driver_test.rs
index 11da393a..5b8367c7 100644
--- a/crates/shirabe/tests/repository/vcs/github_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/github_driver_test.rs
@@ -15,8 +15,6 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::process_executor::{MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -136,8 +134,9 @@ fn test_supports() {
let _tear_down = TearDown::new(home.path().to_path_buf());
for (expected, repo_url) in supports_provider() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
assert_eq!(
expected,
@@ -157,13 +156,14 @@ fn test_private_repository() {
let identifier = "v0.0.0";
let sha = "SOMESHA";
- let config = Rc::new(RefCell::new(config));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new()
- .with_is_interactive(true)
- .with_ask_and_hide_answer(Some("sometoken".to_string())),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new()
+ .with_is_interactive(true)
+ .with_ask_and_hide_answer(Some("sometoken".to_string())),
+ ));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) = get_http_downloader_mock(
vec![
@@ -239,9 +239,10 @@ fn test_public_repository() {
let identifier = "v0.0.0";
let sha = "SOMESHA";
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> =
- Rc::new(RefCell::new(IOStub::new().with_is_interactive(true)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_is_interactive(true)),
+ );
let (http_downloader, _http_guard) = get_http_downloader_mock(
vec![http_body(
@@ -252,7 +253,7 @@ fn test_public_repository() {
HttpDownloaderMockHandler::default(),
);
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(repo_url.to_string()));
@@ -296,9 +297,10 @@ fn test_public_repository2() {
let identifier = "feature/3.2-foo";
let sha = "SOMESHA";
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> =
- Rc::new(RefCell::new(IOStub::new().with_is_interactive(true)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_is_interactive(true)),
+ );
let (http_downloader, _http_guard) = get_http_downloader_mock(
vec![
@@ -329,7 +331,7 @@ fn test_public_repository2() {
HttpDownloaderMockHandler::default(),
);
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(repo_url.to_string()));
@@ -379,9 +381,10 @@ fn test_invalid_support_data() {
let identifier = "feature/3.2-foo";
let sha = "SOMESHA";
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> =
- Rc::new(RefCell::new(IOStub::new().with_is_interactive(true)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_is_interactive(true)),
+ );
let (http_downloader, _http_guard) = get_http_downloader_mock(
vec![
@@ -412,7 +415,7 @@ fn test_invalid_support_data() {
HttpDownloaderMockHandler::default(),
);
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(repo_url.to_string()));
@@ -522,9 +525,10 @@ fn test_funding_format() {
let identifier = "feature/3.2-foo";
let sha = "SOMESHA";
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> =
- Rc::new(RefCell::new(IOStub::new().with_is_interactive(true)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_is_interactive(true)),
+ );
let (http_downloader, _http_guard) = get_http_downloader_mock(
vec![
@@ -552,7 +556,7 @@ fn test_funding_format() {
HttpDownloaderMockHandler::default(),
);
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(repo_url.to_string()));
@@ -621,9 +625,10 @@ fn test_public_repository_archived() {
sha
);
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> =
- Rc::new(RefCell::new(IOStub::new().with_is_interactive(true)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_is_interactive(true)),
+ );
let (http_downloader, _http_guard) = get_http_downloader_mock(
vec![
@@ -657,7 +662,7 @@ fn test_public_repository_archived() {
HttpDownloaderMockHandler::default(),
);
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(repo_url.to_string()));
@@ -688,9 +693,10 @@ fn test_private_repository_no_interaction() {
let identifier = "v0.0.0";
let sha = "SOMESHA";
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> =
- Rc::new(RefCell::new(IOStub::new().with_is_interactive(false)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_is_interactive(false)),
+ );
let (http_downloader, _http_guard) = get_http_downloader_mock(
vec![http_status(repo_api_url, 404)],
@@ -810,12 +816,13 @@ fn test_initialize_invalid_repo_url() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard) =
get_http_downloader_mock(vec![], true, HttpDownloaderMockHandler::default());
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(url.to_string()));
@@ -838,9 +845,10 @@ fn test_get_empty_file_content() {
let repo_url = "http://github.com/composer/packagist";
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> =
- Rc::new(RefCell::new(IOStub::new().with_is_interactive(true)));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_is_interactive(true)),
+ );
let (http_downloader, _http_guard) = get_http_downloader_mock(
vec![
@@ -857,7 +865,7 @@ fn test_get_empty_file_content() {
HttpDownloaderMockHandler::default(),
);
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(repo_url.to_string()));
diff --git a/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs b/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
index f3648630..1a201ba0 100644
--- a/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/gitlab_driver_test.rs
@@ -10,8 +10,6 @@ use shirabe::repository::vcs::GitLabDriver;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe::util::process_executor::{MockHandler, ProcessExecutor};
use shirabe_php_shim::{PhpMixed, extension_loaded};
-use std::cell::RefCell;
-use std::rc::Rc;
// Mirrors GitLabDriverTest::setUp's `gitlab-domains` configuration.
fn make_config() -> Config {
@@ -38,15 +36,16 @@ fn make_config() -> Config {
// bare `getMock()` ProcessExecutor; none of these tests invoke git, so an empty
// strict expectation set both matches PHP and catches unexpected process calls.
struct Fixtures {
- io: Rc<RefCell<dyn IOInterface>>,
- config: Rc<RefCell<Config>>,
- process: Rc<RefCell<ProcessExecutor>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
_process_guard: ProcessExecutorMockGuard,
}
fn fixtures() -> Fixtures {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(make_config()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(make_config()));
let (process, _process_guard) = get_process_executor_mock(vec![], true, MockHandler::default());
Fixtures {
io,
@@ -60,7 +59,10 @@ fn fixtures() -> Fixtures {
fn http_mock_with_body(
url: &str,
body: &str,
-) -> (Rc<RefCell<HttpDownloader>>, HttpDownloaderMockGuard) {
+) -> (
+ std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
+ HttpDownloaderMockGuard,
+) {
get_http_downloader_mock(
vec![expect_full(url, None, 200, body, vec![String::new()])],
true,
@@ -625,8 +627,9 @@ fn test_get_branches() {
#[test]
fn test_supports() {
for (url, expected) in data_for_test_supports() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(make_config()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(make_config()));
assert_eq!(
expected,
@@ -867,7 +870,7 @@ fn test_protocol_override_repository_url_generation() {
);
top.insert("config".to_string(), PhpMixed::Array(config_section));
config.merge(&top, Config::SOURCE_UNKNOWN);
- let config = Rc::new(RefCell::new(config));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
let mut repo_config: IndexMap<String, PhpMixed> = IndexMap::new();
repo_config.insert("url".to_string(), PhpMixed::String(url.to_string()));
diff --git a/crates/shirabe/tests/repository/vcs/hg_driver_test.rs b/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
index 5e16c679..be36f412 100644
--- a/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/hg_driver_test.rs
@@ -12,8 +12,6 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::{PhpMixed, RuntimeException};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -70,8 +68,9 @@ fn supports_data_provider() -> Vec<&'static str> {
#[test]
fn test_supports() {
for repository_url in supports_data_provider() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
assert!(HgDriver::supports(io, config, repository_url, false).unwrap());
}
@@ -82,8 +81,9 @@ fn test_get_branches_filter_invalid_branch_names() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
@@ -120,8 +120,9 @@ fn test_file_get_content_invalid_identifier() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
@@ -148,8 +149,9 @@ fn test_get_change_date_invalid_identifier() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
diff --git a/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs b/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
index 13b36a3c..ea7976fd 100644
--- a/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/perforce_driver_test.rs
@@ -10,8 +10,6 @@ use shirabe::util::HttpDownloader;
use shirabe::util::filesystem::Filesystem;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
const TEST_URL: &str = "TEST_PERFORCE_URL";
@@ -92,9 +90,10 @@ fn make_driver(
config: Config,
repo_config: &IndexMap<String, PhpMixed>,
) -> (PerforceDriver, ProcessExecutorMockGuard) {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(config));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::new(
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config.clone(),
IndexMap::new(),
@@ -130,8 +129,9 @@ impl Drop for TearDown {
#[test]
fn test_supports_returns_false_no_deep_check() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
assert!(!PerforceDriver::supports(io, config, "existing.url", false).unwrap());
}
diff --git a/crates/shirabe/tests/repository/vcs/svn_driver_test.rs b/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
index 70eeeadc..6a74063d 100644
--- a/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
+++ b/crates/shirabe/tests/repository/vcs/svn_driver_test.rs
@@ -12,8 +12,6 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::{PhpMixed, RuntimeException};
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -69,8 +67,9 @@ fn support_provider() -> Vec<(&'static str, bool)> {
#[test]
fn test_support() {
for (url, assertion) in support_provider() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
assert_eq!(
assertion,
@@ -84,8 +83,9 @@ fn test_wrong_credentials_in_url() {
let SetUp { home, config } = set_up();
let _tear_down = TearDown::new(home.path().to_path_buf());
- let config = Rc::new(RefCell::new(config));
- let console: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let console: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) =
get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default());
diff --git a/crates/shirabe/tests/repository/vcs_repository_test.rs b/crates/shirabe/tests/repository/vcs_repository_test.rs
index 1ee72cb8..9ae3eac4 100644
--- a/crates/shirabe/tests/repository/vcs_repository_test.rs
+++ b/crates/shirabe/tests/repository/vcs_repository_test.rs
@@ -11,8 +11,6 @@ use shirabe::util::filesystem::Filesystem;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe::util::r#loop::Loop;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
use tempfile::TempDir;
struct SetUp {
@@ -196,16 +194,19 @@ fn test_load_versions() {
);
top.insert("config".to_string(), PhpMixed::Array(config_section));
config.merge(&top, Config::SOURCE_UNKNOWN);
- let config = Rc::new(RefCell::new(config));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let http_downloader = Rc::new(RefCell::new(HttpDownloader::new(
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let http_downloader = std::rc::Rc::new(std::cell::RefCell::new(HttpDownloader::new(
io.clone(),
config.clone(),
IndexMap::new(),
false,
)));
- let process = Rc::new(RefCell::new(ProcessExecutor::new(Some(io.clone()))));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(Some(
+ io.clone(),
+ ))));
// VcsRepository's git driver / VersionGuesser run async git processes; constructing a Loop
// enables async on the shared ProcessExecutor.
let _loop = Loop::new(http_downloader.clone(), Some(process.clone()));
diff --git a/crates/shirabe/tests/script/event_test.rs b/crates/shirabe/tests/script/event_test.rs
index e249269d..e4fea99d 100644
--- a/crates/shirabe/tests/script/event_test.rs
+++ b/crates/shirabe/tests/script/event_test.rs
@@ -9,13 +9,12 @@ use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::package::{RootPackageHandle, RootPackageInterfaceHandle};
use shirabe::script::{Event, OriginatingEvent};
-use std::cell::RefCell;
-use std::rc::Rc;
fn create_composer_instance() -> ComposerHandle {
- let composer =
- ComposerHandle::from_rc_unchecked(Rc::new(RefCell::new(PartialOrFullComposer::new_full())));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let composer = ComposerHandle::from_rc_unchecked(std::rc::Rc::new(std::cell::RefCell::new(
+ PartialOrFullComposer::new_full(),
+ )));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
composer.borrow_mut().set_config(config);
let package: RootPackageInterfaceHandle = RootPackageHandle::new(
"foo".to_string(),
@@ -29,7 +28,8 @@ fn create_composer_instance() -> ComposerHandle {
#[test]
fn test_event_sets_originating_event() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let composer = create_composer_instance();
let originating_event = BaseEvent::new("originatingEvent".to_string(), vec![], IndexMap::new());
@@ -62,7 +62,8 @@ fn test_event_sets_originating_event() {
#[test]
fn test_event_calculates_nested_originating_event() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let composer = create_composer_instance();
let originating_event =
diff --git a/crates/shirabe/tests/util/auth_helper_test.rs b/crates/shirabe/tests/util/auth_helper_test.rs
index 905cbf7f..d719abf3 100644
--- a/crates/shirabe/tests/util/auth_helper_test.rs
+++ b/crates/shirabe/tests/util/auth_helper_test.rs
@@ -8,21 +8,19 @@ use shirabe::io::IOInterface;
use shirabe::io::io_interface;
use shirabe::util::{AuthHelper, Bitbucket, StoreAuth};
use shirabe_php_shim::{PhpMixed, base64_encode, json_encode};
-use std::cell::RefCell;
-use std::rc::Rc;
// Mirrors AuthHelperTest::setUp: a DEBUG-verbosity IOMock plus a real Config, both
// shared with the AuthHelper under test. The IOMockGuard runs assert_complete on drop.
struct Fixture {
- io: Rc<RefCell<IOMock>>,
- config: Rc<RefCell<shirabe::config::Config>>,
+ io: std::rc::Rc<std::cell::RefCell<IOMock>>,
+ config: std::rc::Rc<std::cell::RefCell<shirabe::config::Config>>,
auth_helper: AuthHelper,
_guard: crate::io_mock::IOMockGuard,
}
-fn set_up_with_config(config: Rc<RefCell<shirabe::config::Config>>) -> Fixture {
+fn set_up_with_config(config: std::rc::Rc<std::cell::RefCell<shirabe::config::Config>>) -> Fixture {
let (mock, guard) = get_io_mock(io_interface::DEBUG).unwrap();
- let io: Rc<RefCell<dyn IOInterface>> = mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = mock.clone();
let auth_helper = AuthHelper::new(io, config.clone());
Fixture {
io: mock,
@@ -38,7 +36,12 @@ fn set_up() -> Fixture {
// Mirrors AuthHelperTest::expectsAuthentication: pre-seed the IO so hasAuthentication
// and getAuthentication return the given credentials for `origin`.
-fn expects_authentication(io: &Rc<RefCell<IOMock>>, origin: &str, username: &str, password: &str) {
+fn expects_authentication(
+ io: &std::rc::Rc<std::cell::RefCell<IOMock>>,
+ origin: &str,
+ username: &str,
+ password: &str,
+) {
use shirabe::io::IOInterfaceMutable;
io.borrow_mut().set_authentication(
origin.to_string(),
diff --git a/crates/shirabe/tests/util/bitbucket_test.rs b/crates/shirabe/tests/util/bitbucket_test.rs
index db45b3e1..d9010ab1 100644
--- a/crates/shirabe/tests/util/bitbucket_test.rs
+++ b/crates/shirabe/tests/util/bitbucket_test.rs
@@ -14,8 +14,6 @@ use shirabe::util::http_downloader::{
};
use shirabe::util::process_executor::MockHandler;
use shirabe_php_shim::{PhpMixed, time};
-use std::cell::RefCell;
-use std::rc::Rc;
const USERNAME: &str = "username";
const PASSWORD: &str = "password";
@@ -60,9 +58,9 @@ fn placeholder_auth_config_source() -> Box<MockConfigSource> {
// real Config, the captured `time()`, and the Bitbucket under test. The mock guards
// run their assert_complete on drop at the end of the test scope.
struct Fixture {
- io: Rc<RefCell<IOMock>>,
- config: Rc<RefCell<Config>>,
- http_downloader: Rc<RefCell<HttpDownloader>>,
+ io: std::rc::Rc<std::cell::RefCell<IOMock>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
time: i64,
bitbucket: Bitbucket,
_io_guard: crate::io_mock::IOMockGuard,
@@ -70,7 +68,7 @@ struct Fixture {
}
fn set_up_with_config_and_http(
- config: Rc<RefCell<Config>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
http_expectations: Vec<HttpDownloaderMockExpectation>,
) -> Fixture {
let (io_mock, io_guard) = get_io_mock(io_interface::DEBUG).unwrap();
@@ -80,7 +78,7 @@ fn set_up_with_config_and_http(
HttpDownloaderMockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let time = time();
let bitbucket = Bitbucket::new(
io,
@@ -127,7 +125,7 @@ fn access_token_body() -> String {
// mirroring BitbucketTest::setExpectationsForStoringAccessToken. Verification happens
// when the mocks are dropped together with the Config.
fn set_expectations_for_storing_access_token(
- config: &Rc<RefCell<Config>>,
+ config: &std::rc::Rc<std::cell::RefCell<Config>>,
time: i64,
remove_basic_auth: bool,
) {
@@ -575,7 +573,7 @@ fn test_authorize_oauth_without_available_git_config_token() {
},
);
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let time = time();
let mut bitbucket =
Bitbucket::new(io, config, Some(process), Some(http_downloader), Some(time)).unwrap();
@@ -592,7 +590,7 @@ fn test_authorize_oauth_with_available_git_config_token() {
let (process, _process_guard) =
get_process_executor_mock(vec![], false, MockHandler::default());
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let time = time();
let mut bitbucket =
Bitbucket::new(io, config, Some(process), Some(http_downloader), Some(time)).unwrap();
diff --git a/crates/shirabe/tests/util/config_validator_test.rs b/crates/shirabe/tests/util/config_validator_test.rs
index 6d7aaf8f..a65cfa56 100644
--- a/crates/shirabe/tests/util/config_validator_test.rs
+++ b/crates/shirabe/tests/util/config_validator_test.rs
@@ -4,8 +4,6 @@ use shirabe::io::io_interface::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::package::loader::validating_array_loader::ValidatingArrayLoader;
use shirabe::util::config_validator::ConfigValidator;
-use std::cell::RefCell;
-use std::rc::Rc;
fn fixture(name: &str) -> String {
format!(
@@ -16,7 +14,8 @@ fn fixture(name: &str) -> String {
}
fn validate(file: &str) -> Vec<String> {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let config_validator = ConfigValidator::new(io);
let (_, _, warnings) = config_validator.validate(
file,
diff --git a/crates/shirabe/tests/util/forgejo_test.rs b/crates/shirabe/tests/util/forgejo_test.rs
index 106cdabc..3829ebf2 100644
--- a/crates/shirabe/tests/util/forgejo_test.rs
+++ b/crates/shirabe/tests/util/forgejo_test.rs
@@ -9,8 +9,6 @@ use shirabe::io::io_interface;
use shirabe::util::Forgejo;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
const USERNAME: &str = "username";
const ACCESS_TOKEN: &str = "access-token";
@@ -63,11 +61,11 @@ fn get_conf_json_mock(origin: &str) -> Box<MockConfigSource> {
}
fn build_forgejo(
- io_mock: &Rc<RefCell<IOMock>>,
- config: Rc<RefCell<Config>>,
- http_downloader: Rc<RefCell<HttpDownloader>>,
+ io_mock: &std::rc::Rc<std::cell::RefCell<IOMock>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
) -> Forgejo {
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
Forgejo::new(io, config, http_downloader)
}
diff --git a/crates/shirabe/tests/util/git_test.rs b/crates/shirabe/tests/util/git_test.rs
index 991dc91c..907ec38a 100644
--- a/crates/shirabe/tests/util/git_test.rs
+++ b/crates/shirabe/tests/util/git_test.rs
@@ -12,8 +12,6 @@ use shirabe::util::git::Git;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe::util::process_executor::{MockExpectation, MockHandler, ProcessExecutor};
use shirabe_php_shim::{PhpMixed, RuntimeException};
-use std::cell::RefCell;
-use std::rc::Rc;
// No-op ConfigSourceInterface, equivalent to PHPUnit's
// `getMockBuilder(Config::class)` auto-stubbing getConfigSource/getAuthConfigSource:
@@ -73,10 +71,15 @@ impl ConfigSourceInterface for NullConfigSource {
// flattens each callable to a `Vec<String>` and hands it to `execute_args`, which always
// builds a `PhpMixed::List`. So the single-token string command becomes a one-element list,
// and the corresponding process expectation is a one-element list as well.
-fn build_git(io: IOStub, config: Config, process: Rc<RefCell<ProcessExecutor>>) -> Git {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(io));
- let config = Rc::new(RefCell::new(config));
- let fs = Rc::new(RefCell::new(Filesystem::new(None)));
+fn build_git(
+ io: IOStub,
+ config: Config,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
+) -> Git {
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(io));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(config));
+ let fs = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(None)));
Git::new(io, config, process, fs)
}
diff --git a/crates/shirabe/tests/util/github_test.rs b/crates/shirabe/tests/util/github_test.rs
index b9abeb26..377a44fa 100644
--- a/crates/shirabe/tests/util/github_test.rs
+++ b/crates/shirabe/tests/util/github_test.rs
@@ -9,8 +9,6 @@ use shirabe::io::io_interface;
use shirabe::util::GitHub;
use shirabe::util::http_downloader::{HttpDownloader, HttpDownloaderMockHandler};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
const PASSWORD: &str = "password";
const MESSAGE: &str = "mymessage";
@@ -62,18 +60,18 @@ fn get_conf_json_mock(origin: &str) -> Box<MockConfigSource> {
}
fn build_github(
- io_mock: &Rc<RefCell<IOMock>>,
- config: Rc<RefCell<Config>>,
- http_downloader: Rc<RefCell<HttpDownloader>>,
+ io_mock: &std::rc::Rc<std::cell::RefCell<IOMock>>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
) -> GitHub {
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
GitHub::new(io, config, None, Some(http_downloader)).unwrap()
}
// The PHP Config mock returns null for `get('github-expose-hostname')`, which is
// falsy and skips the `hostname` process call. A real Config defaults that key to
// true, so the stub seeds false to reproduce the mock's behaviour.
-fn build_config() -> Rc<RefCell<Config>> {
+fn build_config() -> std::rc::Rc<std::cell::RefCell<Config>> {
ConfigStubBuilder::new()
.with("github-expose-hostname", PhpMixed::Bool(false))
.build_shared()
diff --git a/crates/shirabe/tests/util/gitlab_test.rs b/crates/shirabe/tests/util/gitlab_test.rs
index 46c03585..70aa4656 100644
--- a/crates/shirabe/tests/util/gitlab_test.rs
+++ b/crates/shirabe/tests/util/gitlab_test.rs
@@ -9,8 +9,6 @@ use shirabe::io::io_interface;
use shirabe::util::GitLab;
use shirabe::util::http_downloader::HttpDownloaderMockHandler;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
const USERNAME: &str = "username";
const PASSWORD: &str = "password";
@@ -50,7 +48,10 @@ fn get_auth_json_mock() -> Box<MockAuthJson> {
Box::new(mock)
}
-fn set_up(io_mock: &Rc<RefCell<IOMock>>, config: &Rc<RefCell<Config>>) {
+fn set_up(
+ io_mock: &std::rc::Rc<std::cell::RefCell<IOMock>>,
+ config: &std::rc::Rc<std::cell::RefCell<Config>>,
+) {
config
.borrow_mut()
.set_auth_config_source(get_auth_json_mock());
@@ -91,7 +92,7 @@ fn test_username_password_authentication_flow() {
let config = ConfigStubBuilder::new().build_shared();
set_up(&io_mock, &config);
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let mut gitlab = GitLab::new(io, config, None, Some(http_downloader)).unwrap();
assert!(
@@ -138,7 +139,7 @@ fn test_username_password_failure() {
let config = ConfigStubBuilder::new().build_shared();
set_up(&io_mock, &config);
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
let mut gitlab = GitLab::new(io, config, None, Some(http_downloader)).unwrap();
let err = gitlab
diff --git a/crates/shirabe/tests/util/http_downloader_test.rs b/crates/shirabe/tests/util/http_downloader_test.rs
index b1841840..2be5eb96 100644
--- a/crates/shirabe/tests/util/http_downloader_test.rs
+++ b/crates/shirabe/tests/util/http_downloader_test.rs
@@ -12,8 +12,6 @@ use shirabe::util::Platform;
use shirabe::util::http_downloader::HttpDownloader;
use shirabe_external_packages::symfony::console::output::output_interface::VERBOSITY_NORMAL;
use shirabe_php_shim::{PHP_EOL, PhpMixed};
-use std::cell::RefCell;
-use std::rc::Rc;
// PHP performs a live HTTP get to assert the URL's user:pass is captured via
// setAuthentication. The credential capture happens in `add_job`, before any
@@ -37,12 +35,12 @@ fn test_capture_authentication_params_from_url() {
.unwrap();
// The PHP Config mock returns [] for github-domains/gitlab-domains.
- let config: Rc<RefCell<Config>> = ConfigStubBuilder::new()
+ let config: std::rc::Rc<std::cell::RefCell<Config>> = ConfigStubBuilder::new()
.with("github-domains", PhpMixed::Array(IndexMap::new()))
.with("gitlab-domains", PhpMixed::Array(IndexMap::new()))
.build_shared();
- let io: Rc<RefCell<dyn IOInterface>> = io_mock.clone();
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io_mock.clone();
Platform::put_env("COMPOSER_DISABLE_NETWORK", "1");
let mut fs = HttpDownloader::new(io, config, IndexMap::new(), false);
@@ -59,10 +57,10 @@ fn test_capture_authentication_params_from_url() {
#[test]
fn test_output_warnings() {
- let io: Rc<RefCell<BufferIO>> = Rc::new(RefCell::new(
+ let io: std::rc::Rc<std::cell::RefCell<BufferIO>> = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), VERBOSITY_NORMAL, None).unwrap(),
));
- let io_dyn: Rc<RefCell<dyn IOInterface>> = io.clone();
+ let io_dyn: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = io.clone();
HttpDownloader::output_warnings(io_dyn.clone(), "$URL", &IndexMap::new()).unwrap();
assert_eq!("", io.borrow().get_output());
diff --git a/crates/shirabe/tests/util/perforce_test.rs b/crates/shirabe/tests/util/perforce_test.rs
index b6f8f116..b63a5e0e 100644
--- a/crates/shirabe/tests/util/perforce_test.rs
+++ b/crates/shirabe/tests/util/perforce_test.rs
@@ -9,8 +9,6 @@ use shirabe::util::Perforce;
use shirabe::util::filesystem::Filesystem;
use shirabe::util::process_executor::{MockHandler, ProcessExecutor};
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
const TEST_DEPOT: &str = "depot";
const TEST_BRANCH: &str = "branch";
@@ -41,8 +39,9 @@ fn get_test_repo_config() -> IndexMap<String, PhpMixed> {
}
fn create_new_perforce_with_windows_flag(flag: bool) -> Perforce {
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
Perforce::new(
get_test_repo_config(),
TEST_PORT.to_string(),
@@ -57,8 +56,8 @@ fn create_new_perforce_with_windows_flag(flag: bool) -> Perforce {
// ProcessExecutor and IO it configured, matching the PHP `setUp` wiring.
fn create_perforce(
flag: bool,
- process: Rc<RefCell<ProcessExecutor>>,
- io: Rc<RefCell<dyn IOInterface>>,
+ process: std::rc::Rc<std::cell::RefCell<ProcessExecutor>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
) -> Perforce {
Perforce::new(
get_test_repo_config(),
@@ -201,7 +200,8 @@ fn test_query_p4_user_with_user_set_in_p4_variables_with_windows_os() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
perforce.set_user(None);
@@ -224,7 +224,8 @@ fn test_query_p4_user_with_user_set_in_p4_variables_not_windows_os() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(false, process, io);
perforce.set_user(None);
@@ -240,9 +241,10 @@ fn test_query_p4_user_queries_for_user() {
// Non-strict empty process mock: the p4-variable lookup returns empty so the
// code falls through to io->ask().
let (process, _guard) = get_process_executor_mock(vec![], false, MockHandler::default());
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new().with_ask(PhpMixed::String("TEST_QUERY_USER".to_string())),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new().with_ask(PhpMixed::String("TEST_QUERY_USER".to_string())),
+ ));
let mut perforce = create_perforce(true, process, io);
perforce.set_user(None);
@@ -261,9 +263,10 @@ fn test_query_p4_user_stores_response_to_query_for_user_with_windows() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new().with_ask(PhpMixed::String("TEST_QUERY_USER".to_string())),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new().with_ask(PhpMixed::String("TEST_QUERY_USER".to_string())),
+ ));
let mut perforce = create_perforce(true, process, io);
perforce.set_user(None);
@@ -284,9 +287,10 @@ fn test_query_p4_user_stores_response_to_query_for_user_without_windows() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new().with_ask(PhpMixed::String("TEST_QUERY_USER".to_string())),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new().with_ask(PhpMixed::String("TEST_QUERY_USER".to_string())),
+ ));
let mut perforce = create_perforce(false, process, io);
perforce.set_user(None);
@@ -304,9 +308,10 @@ fn test_query_p4_user_escapes_injection_on_windows() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new().with_ask(PhpMixed::String("foo && calc.exe".to_string())),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new().with_ask(PhpMixed::String("foo && calc.exe".to_string())),
+ ));
let mut perforce = create_perforce(true, process, io);
perforce.set_user(None);
@@ -324,9 +329,9 @@ fn test_query_p4_user_escapes_injection_on_unix() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new().with_ask(PhpMixed::String("foo; id".to_string())),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_ask(PhpMixed::String("foo; id".to_string()))),
+ );
let mut perforce = create_perforce(false, process, io);
perforce.set_user(None);
@@ -343,8 +348,9 @@ fn test_query_p4_password_with_password_already_set() {
"p4password".to_string(),
PhpMixed::String("TEST_PASSWORD".to_string()),
);
- let process = Rc::new(RefCell::new(ProcessExecutor::new(None)));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let process = std::rc::Rc::new(std::cell::RefCell::new(ProcessExecutor::new(None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = Perforce::new(
repo_config,
"port".to_string(),
@@ -373,7 +379,8 @@ fn test_query_p4_password_with_password_set_in_p4_variables_with_windows_os() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
let password = perforce.query_p4_password();
@@ -392,7 +399,8 @@ fn test_query_p4_password_with_password_set_in_p4_variables_not_windows_os() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(false, process, io);
let password = perforce.query_p4_password();
@@ -404,9 +412,10 @@ fn test_query_p4_password_queries_for_password() {
// Non-strict empty process mock: the p4-variable lookup returns empty so the
// code falls through to io->askAndHideAnswer().
let (process, _guard) = get_process_executor_mock(vec![], false, MockHandler::default());
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new().with_ask_and_hide_answer(Some("TEST_QUERY_PASSWORD".to_string())),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new().with_ask_and_hide_answer(Some("TEST_QUERY_PASSWORD".to_string())),
+ ));
let mut perforce = create_perforce(true, process, io);
let password = perforce.query_p4_password();
@@ -420,7 +429,8 @@ fn test_is_logged_in() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
perforce.is_logged_in().unwrap();
@@ -467,7 +477,8 @@ fn test_get_branches_with_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
perforce.set_stream("//depot/branch");
@@ -487,7 +498,8 @@ fn test_get_branches_without_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
let branches = perforce.get_branches();
@@ -519,7 +531,8 @@ fn test_get_tags_without_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
let tags = perforce.get_tags();
@@ -552,7 +565,8 @@ fn test_get_tags_with_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
perforce.set_stream("//depot/branch");
@@ -582,7 +596,8 @@ fn test_check_stream_with_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
let result = perforce.check_stream();
@@ -612,7 +627,8 @@ fn test_get_composer_information_without_label_without_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
let result = perforce.get_composer_information("//depot").unwrap();
@@ -657,7 +673,8 @@ fn test_get_composer_information_with_label_without_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
let result = perforce.get_composer_information("//depot@0.0.1").unwrap();
@@ -686,7 +703,8 @@ fn test_get_composer_information_without_label_with_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
perforce.set_stream("//depot/branch");
@@ -732,7 +750,8 @@ fn test_get_composer_information_with_label_with_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
perforce.set_stream("//depot/branch");
@@ -761,7 +780,8 @@ fn test_sync_code_base_without_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
perforce.sync_code_base(Some("label")).unwrap();
@@ -786,7 +806,8 @@ fn test_sync_code_base_with_stream() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process, io);
perforce.set_stream("//depot/branch");
@@ -849,10 +870,11 @@ fn test_cleanup_client_spec_should_delete_client() {
true,
MockHandler::default(),
);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
let mut perforce = create_perforce(true, process.clone(), io);
- let fs = Rc::new(RefCell::new(Filesystem::new(Some(process))));
+ let fs = std::rc::Rc::new(std::cell::RefCell::new(Filesystem::new(Some(process))));
perforce.set_filesystem(fs);
perforce.cleanup_client_spec();
diff --git a/crates/shirabe/tests/util/process_executor_test.rs b/crates/shirabe/tests/util/process_executor_test.rs
index 78c5f9f7..e093a801 100644
--- a/crates/shirabe/tests/util/process_executor_test.rs
+++ b/crates/shirabe/tests/util/process_executor_test.rs
@@ -16,8 +16,6 @@ use shirabe_external_packages::symfony::console::output::output_interface::{
OutputInterface, VERBOSITY_DEBUG, VERBOSITY_NORMAL,
};
use shirabe_php_shim::{PHP_EOL, trim};
-use std::cell::RefCell;
-use std::rc::Rc;
#[test]
fn test_execute_captures_output() {
@@ -90,11 +88,12 @@ fn hide_password_provider() -> Vec<(&'static str, &'static str)> {
#[test]
fn test_hide_passwords() {
for (command, expected_command_output) in hide_password_provider() {
- let buffer = Rc::new(RefCell::new(
+ let buffer = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), VERBOSITY_DEBUG, None).unwrap(),
));
- let mut process =
- ProcessExecutor::new(Some(buffer.clone() as Rc<RefCell<dyn IOInterface>>));
+ let mut process = ProcessExecutor::new(Some(
+ buffer.clone() as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>
+ ));
let mut output = String::new();
process.execute(command, &mut output, None).unwrap();
assert_eq!(
@@ -106,10 +105,12 @@ fn test_hide_passwords() {
#[test]
fn test_doesnt_hide_ports() {
- let buffer = Rc::new(RefCell::new(
+ let buffer = std::rc::Rc::new(std::cell::RefCell::new(
BufferIO::new(String::new(), VERBOSITY_DEBUG, None).unwrap(),
));
- let mut process = ProcessExecutor::new(Some(buffer.clone() as Rc<RefCell<dyn IOInterface>>));
+ let mut process = ProcessExecutor::new(Some(
+ buffer.clone() as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>
+ ));
let mut output = String::new();
process
.execute("echo https://localhost:1234/", &mut output, None)
@@ -128,21 +129,22 @@ fn test_split_lines() {
#[test]
fn test_console_io_does_not_format_symfony_console_style() {
- let output = Rc::new(RefCell::new(BufferedOutput::new(
+ let output = std::rc::Rc::new(std::cell::RefCell::new(BufferedOutput::new(
Some(VERBOSITY_NORMAL),
true,
None,
)));
- let input: Rc<RefCell<dyn InputInterface>> =
- Rc::new(RefCell::new(ArrayInput::new(vec![], None).unwrap()));
+ let input: std::rc::Rc<std::cell::RefCell<dyn InputInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(ArrayInput::new(vec![], None).unwrap()),
+ );
let console_io = ConsoleIO::new(
input,
- output.clone() as Rc<RefCell<dyn OutputInterface>>,
+ output.clone() as std::rc::Rc<std::cell::RefCell<dyn OutputInterface>>,
QuestionHelper::default(),
);
- let mut process = ProcessExecutor::new(Some(
- Rc::new(RefCell::new(console_io)) as Rc<RefCell<dyn IOInterface>>
- ));
+ let mut process =
+ ProcessExecutor::new(Some(std::rc::Rc::new(std::cell::RefCell::new(console_io))
+ as std::rc::Rc<std::cell::RefCell<dyn IOInterface>>));
process
.execute(
diff --git a/crates/shirabe/tests/util/remote_filesystem_test.rs b/crates/shirabe/tests/util/remote_filesystem_test.rs
index c699b94a..9c1fe0bd 100644
--- a/crates/shirabe/tests/util/remote_filesystem_test.rs
+++ b/crates/shirabe/tests/util/remote_filesystem_test.rs
@@ -9,13 +9,11 @@ use shirabe_php_shim::{
PHP_URL_HOST, PhpMixed, STREAM_NOTIFY_FILE_SIZE_IS, STREAM_NOTIFY_PROGRESS, file_get_contents,
parse_url, strpos, unlink,
};
-use std::cell::RefCell;
-use std::rc::Rc;
// Mirrors RemoteFilesystemTest::getConfigMock: get('github-domains') and
// get('gitlab-domains') return [], everything else returns null. add_authentication_options
// reads gitlab-domains, so seed it as an empty list.
-fn config_mock() -> Rc<RefCell<shirabe::config::Config>> {
+fn config_mock() -> std::rc::Rc<std::cell::RefCell<shirabe::config::Config>> {
ConfigStubBuilder::new()
.with("github-domains", PhpMixed::List(vec![]))
.with("gitlab-domains", PhpMixed::List(vec![]))
@@ -25,7 +23,7 @@ fn config_mock() -> Rc<RefCell<shirabe::config::Config>> {
// Mirrors RemoteFilesystemTest::callGetOptionsForUrl: build a RemoteFilesystem, set the
// private file_url, then invoke the private get_options_for_url with the given args.
fn call_get_options_for_url(
- io: Rc<RefCell<dyn IOInterface>>,
+ io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>>,
origin_url: &str,
additional_options: IndexMap<String, PhpMixed>,
options: IndexMap<String, PhpMixed>,
@@ -50,8 +48,9 @@ fn http_header_list(res: &IndexMap<String, PhpMixed>) -> Option<Vec<String>> {
#[test]
fn test_get_options_for_url() {
- let io: Rc<RefCell<dyn IOInterface>> =
- Rc::new(RefCell::new(IOStub::new().with_has_authentication(false)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> = std::rc::Rc::new(
+ std::cell::RefCell::new(IOStub::new().with_has_authentication(false)),
+ );
let res = call_get_options_for_url(
io,
@@ -72,11 +71,12 @@ fn test_get_options_for_url_with_authorization() {
let mut auth: IndexMap<String, Option<String>> = IndexMap::new();
auth.insert("username".to_string(), Some("login".to_string()));
auth.insert("password".to_string(), Some("password".to_string()));
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new()
- .with_has_authentication(true)
- .with_get_authentication(auth),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new()
+ .with_has_authentication(true)
+ .with_get_authentication(auth),
+ ));
let options = call_get_options_for_url(
io,
@@ -100,11 +100,12 @@ fn test_get_options_for_url_with_stream_options() {
let mut auth: IndexMap<String, Option<String>> = IndexMap::new();
auth.insert("username".to_string(), None);
auth.insert("password".to_string(), None);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new()
- .with_has_authentication(true)
- .with_get_authentication(auth),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new()
+ .with_has_authentication(true)
+ .with_get_authentication(auth),
+ ));
let mut ssl: IndexMap<String, PhpMixed> = IndexMap::new();
ssl.insert("allow_self_signed".to_string(), PhpMixed::Bool(true));
@@ -136,11 +137,12 @@ fn test_get_options_for_url_with_call_options_keeps_header() {
let mut auth: IndexMap<String, Option<String>> = IndexMap::new();
auth.insert("username".to_string(), None);
auth.insert("password".to_string(), None);
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(
- IOStub::new()
- .with_has_authentication(true)
- .with_get_authentication(auth),
- ));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(
+ IOStub::new()
+ .with_has_authentication(true)
+ .with_get_authentication(auth),
+ ));
let mut http: IndexMap<String, PhpMixed> = IndexMap::new();
http.insert(
@@ -172,7 +174,8 @@ fn test_get_options_for_url_with_call_options_keeps_header() {
#[test]
fn test_callback_get_file_size() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let mut fs = RemoteFilesystem::new(io, config_mock(), IndexMap::new(), false, None);
fs.__callback_get(STREAM_NOTIFY_FILE_SIZE_IS, 0, Some(String::new()), 0, 0, 20)
.unwrap();
@@ -181,7 +184,8 @@ fn test_callback_get_file_size() {
#[test]
fn test_callback_get_notify_progress() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let mut fs = RemoteFilesystem::new(io, config_mock(), IndexMap::new(), false, None);
fs.__set_bytes_max(20);
fs.__set_progress(true);
@@ -193,7 +197,8 @@ fn test_callback_get_notify_progress() {
#[test]
fn test_callback_get_passes_through404() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let mut fs = RemoteFilesystem::new(io, config_mock(), IndexMap::new(), false, None);
fs.__callback_get(
@@ -226,7 +231,8 @@ fn this_file() -> String {
#[test]
fn test_get_contents() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let mut fs = RemoteFilesystem::new(io, config_mock(), IndexMap::new(), false, None);
let res = fs
@@ -242,7 +248,8 @@ fn test_get_contents() {
#[test]
fn test_copy() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let mut fs = RemoteFilesystem::new(io, config_mock(), IndexMap::new(), false, None);
let file = tempfile::NamedTempFile::new().unwrap();
@@ -293,7 +300,8 @@ fn provide_bitbucket_public_download_urls() -> Vec<(&'static str, &'static str)>
#[ignore = "performs a real network download; get_remote_contents has no stream layer (TODO(phase-c)) and returns None, so getContents raises a TransportException"]
fn test_bit_bucket_public_download() {
for (url, contents) in provide_bitbucket_public_download_urls() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(IOStub::new()));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(IOStub::new()));
let mut rfs = RemoteFilesystem::new(io, config_mock(), IndexMap::new(), false, None);
let hostname = parse_url(url, PHP_URL_HOST);
let hostname = hostname.as_string().unwrap_or("");
diff --git a/crates/shirabe/tests/util/svn_test.rs b/crates/shirabe/tests/util/svn_test.rs
index f7006345..650fbd89 100644
--- a/crates/shirabe/tests/util/svn_test.rs
+++ b/crates/shirabe/tests/util/svn_test.rs
@@ -6,8 +6,6 @@ use shirabe::io::IOInterface;
use shirabe::io::null_io::NullIO;
use shirabe::util::svn::Svn;
use shirabe_php_shim::PhpMixed;
-use std::cell::RefCell;
-use std::rc::Rc;
fn map(pairs: Vec<(&str, PhpMixed)>) -> IndexMap<String, PhpMixed> {
pairs.into_iter().map(|(k, v)| (k.to_string(), v)).collect()
@@ -43,8 +41,9 @@ fn url_provider() -> Vec<(&'static str, Vec<&'static str>)> {
#[test]
fn test_credentials() {
for (url, expect) in url_provider() {
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
let mut svn = Svn::new(url.to_string(), io, config, None);
let expect: Vec<String> = expect.iter().map(|s| s.to_string()).collect();
@@ -56,8 +55,9 @@ fn test_credentials() {
fn test_interactive_string() {
let url = "http://svn.example.org";
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let config = Rc::new(RefCell::new(Config::new(true, None)));
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let config = std::rc::Rc::new(std::cell::RefCell::new(Config::new(true, None)));
let mut svn = Svn::new(url.to_string(), io, config, None);
assert_eq!(
@@ -79,8 +79,14 @@ fn test_credentials_from_config() {
let mut config = Config::new(true, None);
config.merge(&http_basic_config("svn.apache.org", "foo", "bar"), "test");
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let mut svn = Svn::new(url.to_string(), io, Rc::new(RefCell::new(config)), None);
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let mut svn = Svn::new(
+ url.to_string(),
+ io,
+ std::rc::Rc::new(std::cell::RefCell::new(config)),
+ None,
+ );
assert_eq!(
vec![
@@ -100,8 +106,14 @@ fn test_credentials_from_config_with_cache_credentials_true() {
let mut config = Config::new(true, None);
config.merge(&http_basic_config("svn.apache.org", "foo", "bar"), "test");
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let mut svn = Svn::new(url.to_string(), io, Rc::new(RefCell::new(config)), None);
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let mut svn = Svn::new(
+ url.to_string(),
+ io,
+ std::rc::Rc::new(std::cell::RefCell::new(config)),
+ None,
+ );
svn.set_cache_credentials(true);
assert_eq!(
@@ -122,8 +134,14 @@ fn test_credentials_from_config_with_cache_credentials_false() {
let mut config = Config::new(true, None);
config.merge(&http_basic_config("svn.apache.org", "foo", "bar"), "test");
- let io: Rc<RefCell<dyn IOInterface>> = Rc::new(RefCell::new(NullIO::new()));
- let mut svn = Svn::new(url.to_string(), io, Rc::new(RefCell::new(config)), None);
+ let io: std::rc::Rc<std::cell::RefCell<dyn IOInterface>> =
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new()));
+ let mut svn = Svn::new(
+ url.to_string(),
+ io,
+ std::rc::Rc::new(std::cell::RefCell::new(config)),
+ None,
+ );
svn.set_cache_credentials(false);
assert_eq!(