From 21657348b1bfba8fc731dab66bb192be97f70c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jeromos=20Kov=C3=A1cs?= Date: Mon, 2 Feb 2026 14:12:25 +0100 Subject: [PATCH] chore(deps): drop `is-terminal` dependency in favour of std functionality in `detect-tty` feature --- Cargo.toml | 5 ++--- src/condition.rs | 22 ++++++++++------------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d4beb98..b870ab2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ keywords = ["ansi", "terminal", "color", "format", "paint"] readme = "README.md" license = "MIT OR Apache-2.0" categories = ["command-line-interface"] -rust-version = "1.63" +rust-version = "1.85" edition = "2021" resolver = "2" @@ -18,7 +18,7 @@ all-features = true [features] default = ["std"] -detect-tty = ["is-terminal", "std"] +detect-tty = ["std"] detect-env = ["std"] hyperlink = ["std"] std = ["alloc"] @@ -28,4 +28,3 @@ alloc = [] _nightly = [] [dependencies] -is-terminal = { version = "0.4.11", optional = true } diff --git a/src/condition.rs b/src/condition.rs index 6444c17..a1cf97d 100644 --- a/src/condition.rs +++ b/src/condition.rs @@ -22,13 +22,11 @@ use core::sync::atomic::{AtomicPtr, Ordering}; /// `yansi` comes with built-in conditions for common scenarios that can be /// enabled via crate features: /// -/// | feature(s) | condition | implication | -/// |------------------------------|---------------------------------|------------------------| -/// | `detect-tty` | [TTY Detectors] | `std`, [`is-terminal`] | -/// | `detect-env` | [Environment Variable Checkers] | `std` | -/// | [`detect-tty`, `detect-env`] | All Above, [Combo Detectors] | `std`, [`is-terminal`] | -/// -/// [`is-terminal`]: https://docs.rs/is-terminal +/// | feature(s) | condition | implication | +/// |------------------------------|---------------------------------|-------------| +/// | `detect-tty` | [TTY Detectors] | `std` | +/// | `detect-env` | [Environment Variable Checkers] | `std` | +/// | [`detect-tty`, `detect-env`] | All Above, [Combo Detectors] | `std` | /// /// For example, to enable the TTY detectors, enable the `detect-tty` feature: /// @@ -314,22 +312,22 @@ macro_rules! conditions { } #[cfg(feature = "detect-tty")] -use is_terminal::is_terminal as is_tty; +use std::io::IsTerminal; conditions! { feature = "detect-tty" - is_tty(&std::io::stdout()), + std::io::stdout().is_terminal(), STDOUT_IS_TTY: stdout_is_tty, STDOUT_IS_TTY_LIVE: stdout_is_tty_live, - is_tty(&std::io::stderr()), + std::io::stderr().is_terminal(), STDERR_IS_TTY: stderr_is_tty, STDERR_IS_TTY_LIVE: stderr_is_tty_live, - is_tty(&std::io::stdin()), + std::io::stdin().is_terminal(), STDIN_IS_TTY: stdin_is_tty, STDIN_IS_TTY_LIVE: stdin_is_tty_live, - is_tty(&std::io::stdout()) && is_tty(&std::io::stderr()), + std::io::stdout().is_terminal() && std::io::stderr().is_terminal(), STDOUTERR_ARE_TTY: stdouterr_are_tty, STDOUTERR_ARE_TTY_LIVE: stdouterr_are_tty_live, }