Skip to content

Commit 549bec1

Browse files
committed
feat: make is_terminal replaceable with std via cfg
1 parent b4892d4 commit 549bec1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ evcxr = []
3030
win_crlf = []
3131
# This feature is inentionally opt-out (enabled by default) not to break older clients,
3232
# although it may become no-op with a MSRV bummp (which is considered a minor change) and removed with a major update
33-
# TODO: make this feature no-op once MSRV is at least `1.70`
3433
legacy-is-terminal = ["is-terminal"]
3534

3635
[[bin]]
@@ -45,6 +44,9 @@ name = "prettytable"
4544
unicode-width = "0.1"
4645
term = "0.7"
4746
lazy_static = "1.4"
48-
is-terminal = { version = "0.4", optional = true }
4947
encode_unicode = "1.0"
5048
csv = { version = "1.1", optional = true }
49+
50+
# TODO: remove it once MSRV is at least `1.70`
51+
[target.'cfg(not(prettytable_is_terminal_implementation = "std"))'.dependencies]
52+
is-terminal = { version = "0.4", optional = true }

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ impl<'a> TableSlice<'a> {
194194
/// # Returns
195195
/// A `Result` holding the number of lines printed, or an `io::Error` if any failure happens
196196
pub fn print_tty(&self, force_colorize: bool) -> Result<usize, Error> {
197-
#[cfg(not(feature = "legacy-is-terminal"))]
197+
#[cfg(prettytable_is_terminal_implementation = "std")]
198198
use std::io::IsTerminal;
199-
#[cfg(feature = "legacy-is-terminal")]
199+
#[cfg(not(prettytable_is_terminal_implementation = "std"))]
200200
use is_terminal::IsTerminal;
201201

202202
match (stdout(), io::stdout().is_terminal() || force_colorize) {

0 commit comments

Comments
 (0)