diff options
Diffstat (limited to 'crates/turtle/src/atuin_client/settings.rs')
| -rw-r--r-- | crates/turtle/src/atuin_client/settings.rs | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/crates/turtle/src/atuin_client/settings.rs b/crates/turtle/src/atuin_client/settings.rs index 074b2634..bfb8d001 100644 --- a/crates/turtle/src/atuin_client/settings.rs +++ b/crates/turtle/src/atuin_client/settings.rs @@ -49,25 +49,25 @@ pub(crate) enum SearchMode { impl SearchMode { pub(crate) fn as_str(self) -> &'static str { match self { - SearchMode::Prefix => "PREFIX", - SearchMode::FullText => "FULLTXT", - SearchMode::Fuzzy => "FUZZY", - SearchMode::Skim => "SKIM", - SearchMode::DaemonFuzzy => "DAEMON", + Self::Prefix => "PREFIX", + Self::FullText => "FULLTXT", + Self::Fuzzy => "FUZZY", + Self::Skim => "SKIM", + Self::DaemonFuzzy => "DAEMON", } } pub(crate) fn next(self, settings: &Settings) -> Self { match self { - SearchMode::Prefix => SearchMode::FullText, + Self::Prefix => Self::FullText, // if the user is using skim, we go to skim - SearchMode::FullText if settings.search_mode == SearchMode::Skim => SearchMode::Skim, + Self::FullText if settings.search_mode == Self::Skim => Self::Skim, // if the user is using daemon-fuzzy, we go to daemon-fuzzy - SearchMode::FullText if settings.search_mode == SearchMode::DaemonFuzzy => { - SearchMode::DaemonFuzzy + Self::FullText if settings.search_mode == Self::DaemonFuzzy => { + Self::DaemonFuzzy } // otherwise fuzzy. - SearchMode::FullText => SearchMode::Fuzzy, - SearchMode::Fuzzy | SearchMode::Skim | SearchMode::DaemonFuzzy => SearchMode::Prefix, + Self::FullText => Self::Fuzzy, + Self::Fuzzy | Self::Skim | Self::DaemonFuzzy => Self::Prefix, } } } @@ -96,12 +96,12 @@ pub(crate) enum FilterMode { impl FilterMode { pub(crate) fn as_str(self) -> &'static str { match self { - FilterMode::Global => "GLOBAL", - FilterMode::Host => "HOST", - FilterMode::Session => "SESSION", - FilterMode::Directory => "DIRECTORY", - FilterMode::Workspace => "WORKSPACE", - FilterMode::SessionPreload => "SESSION+", + Self::Global => "GLOBAL", + Self::Host => "HOST", + Self::Session => "SESSION", + Self::Directory => "DIRECTORY", + Self::Workspace => "WORKSPACE", + Self::SessionPreload => "SESSION+", } } } @@ -127,10 +127,10 @@ pub(crate) enum Dialect { } impl From<Dialect> for interim::Dialect { - fn from(d: Dialect) -> interim::Dialect { + fn from(d: Dialect) -> Self { match d { - Dialect::Uk => interim::Dialect::Uk, - Dialect::Us => interim::Dialect::Us, + Dialect::Uk => Self::Uk, + Dialect::Us => Self::Us, } } } @@ -324,7 +324,7 @@ impl Keys { /// The standard default values for all `[keys]` options. /// These match the config defaults set in `builder_with_data_dir()`. pub(crate) fn standard_defaults() -> Self { - Keys { + Self { scroll_exits: true, exit_past_line_start: true, accept_past_line_end: true, @@ -443,11 +443,11 @@ impl LogLevel { /// Convert to a tracing directive string for use with [`EnvFilter`]. pub(crate) fn as_directive(self) -> &'static str { match self { - LogLevel::Trace => "trace", - LogLevel::Debug => "debug", - LogLevel::Info => "info", - LogLevel::Warn => "warn", - LogLevel::Error => "error", + Self::Trace => "trace", + Self::Debug => "debug", + Self::Info => "info", + Self::Warn => "warn", + Self::Error => "error", } } } @@ -643,20 +643,20 @@ impl UiColumnType { /// The Command column returns 0 as it expands to fill remaining space. pub(crate) fn default_width(self) -> u16 { match self { - UiColumnType::Duration => 5, // "814ms" - UiColumnType::Time => 9, // "459ms ago" - UiColumnType::Datetime => 16, // "2025-01-22 14:35" - UiColumnType::Directory => 20, - UiColumnType::Host => 15, - UiColumnType::User => 10, - UiColumnType::Exit => { + Self::Duration => 5, // "814ms" + Self::Time => 9, // "459ms ago" + Self::Datetime => 16, // "2025-01-22 14:35" + Self::Directory => 20, + Self::Host => 15, + Self::User => 10, + Self::Exit => { if cfg!(windows) { 11 // 32-bit integer on Windows: "-1978335212" } else { 3 // Usually a byte on Unix } } - UiColumnType::Command => 0, // Expands to fill + Self::Command => 0, // Expands to fill } } } @@ -1289,7 +1289,7 @@ impl Settings { pub(crate) fn new() -> Result<Self> { let config = Self::build_config()?; - let settings: Settings = config + let settings: Self = config .try_deserialize() .map_err(|e| eyre!("failed to deserialize: {}", e))?; |
