From 3a388b98a9aa6a14b1c7f7dc909c109cf9837800 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 00:59:54 +0900 Subject: refactor: narrow pub(crate) items to private Porting mapped every PHP `protected` member onto `pub(crate)`, which is wider than nearly all of them need. Each item demoted here is reached only from the module that defines it, so the crate-wide visibility conveyed nothing. Every `pub(crate)` that survives has at least one reader in another module of the same crate. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/installer.rs | 88 ++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 45 deletions(-) (limited to 'crates/shirabe/src/installer.rs') diff --git a/crates/shirabe/src/installer.rs b/crates/shirabe/src/installer.rs index 4ff6af3d..9b4a84e8 100644 --- a/crates/shirabe/src/installer.rs +++ b/crates/shirabe/src/installer.rs @@ -94,51 +94,49 @@ use shirabe_semver::constraint::SimpleConstraint; #[derive(Debug)] pub struct Installer { - pub(crate) io: std::rc::Rc>, - pub(crate) config: std::rc::Rc>, - pub(crate) package: RootPackageInterfaceHandle, + io: std::rc::Rc>, + config: std::rc::Rc>, + package: RootPackageInterfaceHandle, // TODO can we get rid of the below and just use the package itself? - pub(crate) fixed_root_package: RootPackageInterfaceHandle, - pub(crate) download_manager: std::rc::Rc>, - pub(crate) repository_manager: std::rc::Rc>, - pub(crate) locker: std::rc::Rc>, - pub(crate) installation_manager: - std::rc::Rc>, - pub(crate) event_dispatcher: std::rc::Rc>, - pub(crate) autoload_generator: std::rc::Rc>, - pub(crate) prefer_source: bool, - pub(crate) prefer_dist: bool, - pub(crate) optimize_autoloader: bool, - pub(crate) class_map_authoritative: bool, - pub(crate) apcu_autoloader: bool, - pub(crate) apcu_autoloader_prefix: Option, - pub(crate) dev_mode: bool, - pub(crate) dry_run: bool, - pub(crate) download_only: bool, - pub(crate) verbose: bool, - pub(crate) update: bool, - pub(crate) install: bool, - pub(crate) dump_autoloader: bool, - pub(crate) run_scripts: bool, - pub(crate) prefer_stable: bool, - pub(crate) prefer_lowest: bool, - pub(crate) minimal_update: bool, - pub(crate) write_lock: bool, - pub(crate) execute_operations: bool, - pub(crate) audit: bool, - pub(crate) error_on_audit: bool, - pub(crate) audit_format: String, + fixed_root_package: RootPackageInterfaceHandle, + download_manager: std::rc::Rc>, + repository_manager: std::rc::Rc>, + locker: std::rc::Rc>, + installation_manager: std::rc::Rc>, + event_dispatcher: std::rc::Rc>, + autoload_generator: std::rc::Rc>, + prefer_source: bool, + prefer_dist: bool, + optimize_autoloader: bool, + class_map_authoritative: bool, + apcu_autoloader: bool, + apcu_autoloader_prefix: Option, + dev_mode: bool, + dry_run: bool, + download_only: bool, + verbose: bool, + update: bool, + install: bool, + dump_autoloader: bool, + run_scripts: bool, + prefer_stable: bool, + prefer_lowest: bool, + minimal_update: bool, + write_lock: bool, + execute_operations: bool, + audit: bool, + error_on_audit: bool, + audit_format: String, audit_config: Option, ignored_types: Vec, allowed_types: Option>, - pub(crate) update_mirrors: bool, - pub(crate) update_allow_list: Option>, - pub(crate) update_allow_transitive_dependencies: UpdateAllowTransitiveDeps, - pub(crate) suggested_packages_reporter: - std::rc::Rc>, - pub(crate) platform_requirement_filter: std::rc::Rc, - pub(crate) additional_fixed_repository: Option, - pub(crate) temporary_constraints: IndexMap, + update_mirrors: bool, + update_allow_list: Option>, + update_allow_transitive_dependencies: UpdateAllowTransitiveDeps, + suggested_packages_reporter: std::rc::Rc>, + platform_requirement_filter: std::rc::Rc, + additional_fixed_repository: Option, + temporary_constraints: IndexMap, } impl Installer { @@ -552,7 +550,7 @@ impl Installer { } #[tracing::instrument(skip_all)] - pub(crate) fn do_update( + fn do_update( &mut self, local_repo: crate::repository::RepositoryInterfaceHandle, do_install: bool, @@ -915,7 +913,7 @@ impl Installer { /// Run the solver a second time on top of the existing update result with only the current result set in the pool /// and see what packages would get removed if we only had the non-dev packages in the solver request - pub(crate) fn extract_dev_packages( + fn extract_dev_packages( &mut self, lock_transaction: &mut LockTransaction, platform_repo: &PlatformRepositoryHandle, @@ -999,7 +997,7 @@ impl Installer { } /// Whether the function is called as part of an update command or independently - pub(crate) fn do_install( + fn do_install( &mut self, local_repo: crate::repository::RepositoryInterfaceHandle, already_solved: bool, @@ -1285,7 +1283,7 @@ impl Installer { Ok(0) } - pub(crate) fn create_platform_repo( + fn create_platform_repo( &mut self, for_update: bool, ) -> anyhow::Result { -- cgit v1.3.1-4-g156e