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/util/perforce.rs | 44 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'crates/shirabe/src/util/perforce.rs') diff --git a/crates/shirabe/src/util/perforce.rs b/crates/shirabe/src/util/perforce.rs index 246e37f5..fbab6889 100644 --- a/crates/shirabe/src/util/perforce.rs +++ b/crates/shirabe/src/util/perforce.rs @@ -18,22 +18,22 @@ use shirabe_symfony_process::Process; /// @phpstan-type RepoConfig array{unique_perforce_client_name?: string, depot?: string, branch?: string, p4user?: string, p4password?: string} #[derive(Debug)] pub struct Perforce { - pub(crate) path: String, - pub(crate) p4_depot: Option, - pub(crate) p4_client: Option, - pub(crate) p4_user: Option, - pub(crate) p4_password: Option, - pub(crate) p4_port: String, - pub(crate) p4_stream: Option, - pub(crate) p4_client_spec: String, - pub(crate) p4_depot_type: Option, - pub(crate) p4_branch: Option, - pub(crate) process: std::rc::Rc>, - pub(crate) unique_perforce_client_name: String, - pub(crate) windows_flag: bool, - pub(crate) command_result: String, - pub(crate) io: std::rc::Rc>, - pub(crate) filesystem: Option>>, + path: String, + p4_depot: Option, + p4_client: Option, + p4_user: Option, + p4_password: Option, + p4_port: String, + p4_stream: Option, + p4_client_spec: String, + p4_depot_type: Option, + p4_branch: Option, + process: std::rc::Rc>, + unique_perforce_client_name: String, + windows_flag: bool, + command_result: String, + io: std::rc::Rc>, + filesystem: Option>>, } impl Perforce { @@ -147,7 +147,7 @@ impl Perforce { file_system.borrow_mut().remove(&client_spec); } - pub(crate) fn execute_command(&mut self, command: PhpMixed) -> i64 { + fn execute_command(&mut self, command: PhpMixed) -> i64 { self.command_result = String::new(); let cmd_vec: Vec = match &command { @@ -180,7 +180,7 @@ impl Perforce { self.p4_client.clone().unwrap_or_default() } - pub(crate) fn get_path(&self) -> &str { + fn get_path(&self) -> &str { &self.path } @@ -190,7 +190,7 @@ impl Perforce { fs.borrow_mut().ensure_directory_exists(path); } - pub(crate) fn get_port(&self) -> &str { + fn get_port(&self) -> &str { &self.p4_port } @@ -278,7 +278,7 @@ impl Perforce { Ok(()) } - pub(crate) fn get_p4_variable(&mut self, name: &str) -> Option { + fn get_p4_variable(&mut self, name: &str) -> Option { if self.windows_flag { let command = format!("{} set", Self::get_p4_executable()); self.execute_command(PhpMixed::String(command)); @@ -507,7 +507,7 @@ impl Perforce { Ok(()) } - pub(crate) fn read(&self, pipe: &PhpResource, _name: PhpMixed) { + fn read(&self, pipe: &PhpResource, _name: PhpMixed) { if feof(pipe) { return; } @@ -743,7 +743,7 @@ impl Perforce { false } - pub(crate) fn get_change_list(&mut self, reference: &str) -> Option { + fn get_change_list(&mut self, reference: &str) -> Option { let index = strpos(reference, "@")?; let label = substr(reference, index as i64, None); let command = -- cgit v1.3.1-4-g156e