From 27d00055df8691a6bd99aaf38633a7338b16cc6a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 11 Jul 2026 16:33:05 +0900 Subject: chore: use fully-qualified name for Rc/RefCell --- .../tests/repository/vcs/forgejo_driver_test.rs | 18 +++-- .../tests/repository/vcs/fossil_driver_test.rs | 7 +- .../repository/vcs/git_bitbucket_driver_test.rs | 37 +++++---- .../tests/repository/vcs/git_driver_test.rs | 32 ++++---- .../tests/repository/vcs/github_driver_test.rs | 88 ++++++++++++---------- .../tests/repository/vcs/gitlab_driver_test.rs | 25 +++--- .../shirabe/tests/repository/vcs/hg_driver_test.rs | 22 +++--- .../tests/repository/vcs/perforce_driver_test.rs | 14 ++-- .../tests/repository/vcs/svn_driver_test.rs | 12 +-- 9 files changed, 139 insertions(+), 116 deletions(-) (limited to 'crates/shirabe/tests/repository/vcs') 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>, - io: Rc>, + config: std::rc::Rc>, + io: std::rc::Rc>, } 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> = Rc::new(RefCell::new(NullIO::new())); + let io: std::rc::Rc> = + 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>, + http_downloader: std::rc::Rc>, ) -> (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, -) -> (Rc>, HttpDownloaderMockGuard) { +) -> ( + std::rc::Rc>, + 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> = Rc::new(RefCell::new(NullIO::new())); - let config = Rc::new(RefCell::new(Config::new(true, None))); + let io: std::rc::Rc> = + 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>, - config: Rc>, - http_downloader: Rc>, + io: std::rc::Rc>, + config: std::rc::Rc>, + http_downloader: std::rc::Rc>, ) -> anyhow::Result { let mut repo_config: IndexMap = 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(NullIO::new())); - let config = Rc::new(RefCell::new(Config::new(true, None))); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(NullIO::new())); - let config = Rc::new(RefCell::new(Config::new(true, None))); + let io: std::rc::Rc> = + 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> = 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::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> = - 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::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 = 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> = - 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::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 = 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> = - 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::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 = 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> = - 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::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 = 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> = - 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::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 = 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> = - 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::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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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 = 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> = - 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::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 = 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>, - config: Rc>, - process: Rc>, + io: std::rc::Rc>, + config: std::rc::Rc>, + process: std::rc::Rc>, _process_guard: ProcessExecutorMockGuard, } fn fixtures() -> Fixtures { - let io: Rc> = Rc::new(RefCell::new(NullIO::new())); - let config = Rc::new(RefCell::new(make_config())); + let io: std::rc::Rc> = + 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>, HttpDownloaderMockGuard) { +) -> ( + std::rc::Rc>, + 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> = Rc::new(RefCell::new(NullIO::new())); - let config = Rc::new(RefCell::new(make_config())); + let io: std::rc::Rc> = + 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 = 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> = Rc::new(RefCell::new(NullIO::new())); - let config = Rc::new(RefCell::new(Config::new(true, None))); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let io: std::rc::Rc> = + 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, ) -> (PerforceDriver, ProcessExecutorMockGuard) { - let io: Rc> = 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::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> = Rc::new(RefCell::new(NullIO::new())); - let config = Rc::new(RefCell::new(Config::new(true, None))); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(NullIO::new())); - let config = Rc::new(RefCell::new(Config::new(true, None))); + let io: std::rc::Rc> = + 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> = Rc::new(RefCell::new(IOStub::new())); + let config = std::rc::Rc::new(std::cell::RefCell::new(config)); + let console: std::rc::Rc> = + std::rc::Rc::new(std::cell::RefCell::new(IOStub::new())); let (http_downloader, _http_guard): (_, HttpDownloaderMockGuard) = get_http_downloader_mock(vec![], false, HttpDownloaderMockHandler::default()); -- cgit v1.3.1