From fc8af6e010b866e868afc444d90bd7d72f2cf28f Mon Sep 17 00:00:00 2001 From: FroVolod Date: Tue, 23 Apr 2024 11:14:46 +0300 Subject: [PATCH] refactor: Updated examples:struct_with_flatten (#19) --- Cargo.toml | 2 -- examples/struct_with_flatten.rs | 21 +-------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 93e04c3..77a4c6f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,6 +25,4 @@ shell-words = "1.0.0" clap = { version = "4.0.18", features = ["derive"] } inquire = "0.6" -atty = "0.2.14" -colored = "2.0" color-eyre = "0.6" diff --git a/examples/struct_with_flatten.rs b/examples/struct_with_flatten.rs index 957c9e4..77f3205 100644 --- a/examples/struct_with_flatten.rs +++ b/examples/struct_with_flatten.rs @@ -231,16 +231,7 @@ impl FromStr for ColorPreference { } fn default_mode() -> ColorPreference { - match env::var("NO_COLOR") { - Ok(v) if v != "0" => ColorPreference::Never, - _ => { - if atty::is(atty::Stream::Stderr) { - ColorPreference::Always - } else { - ColorPreference::Never - } - } - } + ColorPreference::Never } impl ColorPreference { @@ -251,16 +242,6 @@ impl ColorPreference { ColorPreference::Never => "never", } } - - pub fn apply(&self) { - match self { - ColorPreference::Auto => { - default_mode().apply(); - } - ColorPreference::Always => colored::control::set_override(true), - ColorPreference::Never => colored::control::set_override(false), - } - } } fn main() -> color_eyre::Result<()> {