From 199563550dd41c3dfb703bd3747604a8a03cdbc5 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Thu, 11 Jun 2026 14:20:49 +0200 Subject: chore: Remove all `pub`s They will not be marked by rustc/cargo as unused, and as atuin doesn't expose an API all of them _should_ be `pub(crate)` --- crates/turtle/src/command/client/doctor.rs | 60 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'crates/turtle/src/command/client/doctor.rs') diff --git a/crates/turtle/src/command/client/doctor.rs b/crates/turtle/src/command/client/doctor.rs index 09fa6e77..1ed90c47 100644 --- a/crates/turtle/src/command/client/doctor.rs +++ b/crates/turtle/src/command/client/doctor.rs @@ -13,17 +13,17 @@ use sysinfo::{Disks, System, get_current_pid}; #[derive(Debug, Serialize)] struct ShellInfo { - pub name: String, + pub(crate) name: String, // best-effort, not supported on all OSes - pub default: String, + pub(crate) default: String, // Detect some shell plugins that the user has installed. // I'm just going to start with preexec/blesh - pub plugins: Vec, + pub(crate) plugins: Vec, // The preexec framework used in the current session, if Atuin is loaded. - pub preexec: Option, + pub(crate) preexec: Option, } impl ShellInfo { @@ -86,7 +86,7 @@ impl ShellInfo { .map(|_| "blesh".to_string()) } - pub fn plugins(shell: &str, shell_process: &sysinfo::Process) -> Vec { + pub(crate) fn plugins(shell: &str, shell_process: &sysinfo::Process) -> Vec { // consider a different detection approach if there are plugins // that don't set shell vars @@ -167,7 +167,7 @@ impl ShellInfo { .collect() } - pub fn new() -> Self { + pub(crate) fn new() -> Self { // TODO: rework to use crate::atuin_common::Shell let sys = System::new_all(); @@ -199,22 +199,22 @@ impl ShellInfo { #[derive(Debug, Serialize)] struct DiskInfo { - pub name: String, - pub filesystem: String, + pub(crate) name: String, + pub(crate) filesystem: String, } #[derive(Debug, Serialize)] struct SystemInfo { - pub os: String, + pub(crate) os: String, - pub arch: String, + pub(crate) arch: String, - pub version: String, - pub disks: Vec, + pub(crate) version: String, + pub(crate) disks: Vec, } impl SystemInfo { - pub fn new() -> Self { + pub(crate) fn new() -> Self { let disks = Disks::new_with_refreshed_list(); let disks = disks .list() @@ -236,14 +236,14 @@ impl SystemInfo { #[derive(Debug, Serialize)] struct SyncInfo { - pub auth_state: String, - pub auto_sync: bool, + pub(crate) auth_state: String, + pub(crate) auto_sync: bool, - pub last_sync: String, + pub(crate) last_sync: String, } impl SyncInfo { - pub async fn new(settings: &Settings) -> Self { + pub(crate) async fn new(settings: &Settings) -> Self { // Build auth state description from raw token state without calling // resolve_sync_auth(), which has side effects (token migration cleanup) // that a diagnostic command should not trigger. @@ -277,7 +277,7 @@ struct SettingPaths { } impl SettingPaths { - pub fn new(settings: &Settings) -> Self { + pub(crate) fn new(settings: &Settings) -> Self { Self { db: settings.db_path.clone(), record_store: settings.record_store_path.clone(), @@ -285,7 +285,7 @@ impl SettingPaths { } } - pub fn verify(&self) { + pub(crate) fn verify(&self) { let paths = vec![ ("ATUIN_DB_PATH", &self.db), ("ATUIN_RECORD_STORE", &self.record_store), @@ -304,21 +304,21 @@ impl SettingPaths { #[derive(Debug, Serialize)] struct AtuinInfo { - pub version: String, - pub commit: String, + pub(crate) version: String, + pub(crate) commit: String, /// Whether the main Atuin sync server is in use /// I'm just calling it Atuin Cloud for lack of a better name atm - pub sync: Option, + pub(crate) sync: Option, - pub sqlite_version: String, + pub(crate) sqlite_version: String, #[serde(skip)] // probably unnecessary to expose this - pub setting_paths: SettingPaths, + pub(crate) setting_paths: SettingPaths, } impl AtuinInfo { - pub async fn new(settings: &Settings) -> Self { + pub(crate) async fn new(settings: &Settings) -> Self { let logged_in = settings.logged_in().await.unwrap_or(false); let sync = if logged_in { @@ -347,13 +347,13 @@ impl AtuinInfo { #[derive(Debug, Serialize)] struct DoctorDump { - pub atuin: AtuinInfo, - pub shell: ShellInfo, - pub system: SystemInfo, + pub(crate) atuin: AtuinInfo, + pub(crate) shell: ShellInfo, + pub(crate) system: SystemInfo, } impl DoctorDump { - pub async fn new(settings: &Settings) -> Self { + pub(crate) async fn new(settings: &Settings) -> Self { Self { atuin: AtuinInfo::new(settings).await, shell: ShellInfo::new(), @@ -396,7 +396,7 @@ fn checks(info: &DoctorDump) { } } -pub async fn run(settings: &Settings) -> Result<()> { +pub(crate) async fn run(settings: &Settings) -> Result<()> { println!("{}", "Atuin Doctor".bold()); println!("Checking for diagnostics"); let dump = DoctorDump::new(settings).await; -- cgit v1.3.1