Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Clean up anstream related code #113

Merged
merged 2 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/anstream/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ where
StreamInner::PassThrough(w) => w.is_terminal(),
StreamInner::Strip(w) => w.is_terminal(),
#[cfg(all(windows, feature = "wincon"))]
StreamInner::Wincon(w) => true,
StreamInner::Wincon(_) => true, // its only ever a terminal
}
}
}
Expand Down
24 changes: 12 additions & 12 deletions crates/anstyle-wincon/src/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ where
}
}

impl<S> Drop for Console<S>
where
S: crate::WinconStream + std::io::Write,
{
fn drop(&mut self) {
// Otherwise `Console::lock` took it
if self.stream.is_some() {
let _ = self.reset();
}
}
}

impl<S> Console<S>
where
S: crate::WinconStream + std::io::Write,
Expand Down Expand Up @@ -142,15 +154,3 @@ where
self.lock()
}
}

impl<S> Drop for Console<S>
where
S: crate::WinconStream + std::io::Write,
{
fn drop(&mut self) {
// Otherwise `Console::lock` took it
if self.stream.is_some() {
let _ = self.reset();
}
}
}
Loading