chore: fix all 702 clippy warnings across codebase - auto-fix 475 via cargo clippy --fix - fix remaining 227 manually: uninlined_format_args, redundant_closure, match_same_arms, underscore_binding, format_push_string, items_after_statements, needless_pass_by_value, clone_on_copy, case_sensitive_extension, single_match/let-else, write_with_newline, and other clippy lints
24 lines
873 B
Rust
24 lines
873 B
Rust
//! Settings-mode helper logic for the TUI settings overlay.
|
|
//!
|
|
//! Flow: exposes small mutation functions (currently just cycling the
|
|
//! internet access mode) invoked by keybindings while the settings overlay
|
|
//! is active.
|
|
|
|
use crate::model::settings::{Settings, InternetMode};
|
|
|
|
/// Advance the internet access mode to the next value in the cycle.
|
|
///
|
|
/// Flow: Off -> `ReadOnly` -> Full -> Off, wrapping around.
|
|
///
|
|
/// Why: used by a settings-toggle keybinding to step through modes
|
|
/// without needing a dropdown/menu.
|
|
///
|
|
/// Return: nothing; mutates `settings.internet_mode` in place.
|
|
pub fn cycle_internet_mode(settings: &mut Settings) {
|
|
settings.internet_mode = match settings.internet_mode {
|
|
InternetMode::Off => InternetMode::ReadOnly,
|
|
InternetMode::ReadOnly => InternetMode::Full,
|
|
InternetMode::Full => InternetMode::Off,
|
|
};
|
|
}
|