Skip to content

Commit

Permalink
fix!: Focus IsTerminal as an implementation detail
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Sep 28, 2023
1 parent d4ac7b2 commit 565425e
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 34 deletions.
11 changes: 0 additions & 11 deletions crates/anstream/src/auto.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(feature = "auto")]
use crate::ColorChoice;
use crate::IsTerminal;
use crate::RawStream;
use crate::StripStream;
#[cfg(all(windows, feature = "wincon"))]
Expand Down Expand Up @@ -158,16 +157,6 @@ fn choice(raw: &dyn RawStream) -> ColorChoice {
}
}

impl<S> IsTerminal for AutoStream<S>
where
S: RawStream,
{
#[inline]
fn is_terminal(&self) -> bool {
self.is_terminal()
}
}

impl AutoStream<std::io::Stdout> {
/// Get exclusive access to the `AutoStream`
///
Expand Down
2 changes: 1 addition & 1 deletion crates/anstream/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl RawStream for std::fs::File {}

impl RawStream for crate::Buffer {}

pub trait IsTerminal {
pub trait IsTerminal: private::Sealed {
fn is_terminal(&self) -> bool;
}

Expand Down
11 changes: 0 additions & 11 deletions crates/anstream/src/strip.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::adapter::StripBytes;
use crate::IsTerminal;
use crate::RawStream;

/// Only pass printable data to the inner `Write`
Expand Down Expand Up @@ -67,16 +66,6 @@ impl StripStream<std::io::Stderr> {
}
}

impl<S> IsTerminal for StripStream<S>
where
S: RawStream,
{
#[inline]
fn is_terminal(&self) -> bool {
self.is_terminal()
}
}

impl<S> std::io::Write for StripStream<S>
where
S: RawStream,
Expand Down
11 changes: 0 additions & 11 deletions crates/anstream/src/wincon.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::adapter::WinconBytes;
use crate::IsTerminal;
use crate::RawStream;

/// Only pass printable data to the inner `Write`
Expand Down Expand Up @@ -71,16 +70,6 @@ impl WinconStream<std::io::Stderr> {
}
}

impl<S> IsTerminal for WinconStream<S>
where
S: RawStream,
{
#[inline]
fn is_terminal(&self) -> bool {
self.is_terminal()
}
}

impl<S> std::io::Write for WinconStream<S>
where
S: RawStream,
Expand Down

0 comments on commit 565425e

Please sign in to comment.