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/repository/vcs/gitlab_driver.rs | 25 ++++++++++------------ 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'crates/shirabe/src/repository/vcs/gitlab_driver.rs') diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs index 669f1376..df1ad686 100644 --- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs +++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs @@ -26,7 +26,7 @@ use shirabe_php_shim::{ /// Driver for GitLab API, use the Git driver for local checkouts. #[derive(Debug)] pub struct GitLabDriver { - pub(crate) inner: VcsDriverBase, + inner: VcsDriverBase, /// @phpstan-var 'https'|'http' scheme: String, namespace: String, @@ -40,10 +40,10 @@ pub struct GitLabDriver { /// @var array Map of branch name to identifier branches: Option>, /// Git Driver - pub(crate) git_driver: Option, + git_driver: Option, /// Protocol to force use of for repository URLs. /// @var string One of ssh, http - pub(crate) protocol: String, + protocol: String, /// Defaults to true unless we can make sure it is public /// @var bool defines whether the repo is private or not is_private: bool, @@ -595,10 +595,7 @@ impl GitLabDriver { } /// @return string[] where keys are named references like tags or branches and the value a sha - pub(crate) fn get_references( - &mut self, - r#type: &str, - ) -> anyhow::Result> { + fn get_references(&mut self, r#type: &str) -> anyhow::Result> { let per_page = 100; let mut resource: Option = Some(format!( "{}/repository/{}?per_page={}", @@ -661,7 +658,7 @@ impl GitLabDriver { Ok(references) } - pub(crate) fn fetch_project(&mut self) -> anyhow::Result<()> { + fn fetch_project(&mut self) -> anyhow::Result<()> { if self.project.is_some() { return Ok(()); } @@ -694,7 +691,7 @@ impl GitLabDriver { /// @phpstan-impure /// /// @throws \RuntimeException - pub(crate) fn attempt_clone_fallback(&mut self) -> anyhow::Result { + fn attempt_clone_fallback(&mut self) -> anyhow::Result { let url = if !self.is_private { self.generate_public_url() } else { @@ -723,7 +720,7 @@ impl GitLabDriver { } /// Generate an SSH URL - pub(crate) fn generate_ssh_url(&self) -> String { + fn generate_ssh_url(&self) -> String { if self.has_nonstandard_origin { return format!( "ssh://git@{}/{}/{}.git", @@ -737,14 +734,14 @@ impl GitLabDriver { ) } - pub(crate) fn generate_public_url(&self) -> String { + fn generate_public_url(&self) -> String { format!( "{}://{}/{}/{}.git", self.scheme, self.inner.origin_url, self.namespace, self.repository ) } - pub(crate) fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> { + fn setup_git_driver(&mut self, url: &str) -> anyhow::Result<()> { let mut repo_config: IndexMap = IndexMap::new(); repo_config.insert("url".to_string(), PhpMixed::String(url.to_string())); let mut git_driver = GitDriver::new( @@ -759,7 +756,7 @@ impl GitLabDriver { Ok(()) } - pub(crate) fn get_contents( + fn get_contents( &mut self, url: &str, fetching_repo_data: bool, @@ -1009,7 +1006,7 @@ impl GitLabDriver { Ok(self.project.clone()) } - pub(crate) fn get_next_page(&self, response: &Response) -> Option { + fn get_next_page(&self, response: &Response) -> Option { let header = response.get_header("link").unwrap_or_default(); let links = explode(",", &header); -- cgit v1.3.1-4-g156e