Skip to content

Commit

Permalink
Merge pull request #113 from epage/clean
Browse files Browse the repository at this point in the history
refactor: Clean up anstream related code
  • Loading branch information
epage authored Aug 23, 2023
2 parents 9014ef6 + 912eaf4 commit 1d0bac9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
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();
}
}
}

0 comments on commit 1d0bac9

Please sign in to comment.