Skip to content

Commit

Permalink
WinConsole::new is not actually fallible
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Oct 21, 2022
1 parent b1ab3b7 commit 3ff0a33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion library/test/src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub(crate) fn stdout() -> Option<Box<StdoutTerminal>> {
pub(crate) fn stdout() -> Option<Box<StdoutTerminal>> {
TerminfoTerminal::new(io::stdout())
.map(|t| Box::new(t) as Box<StdoutTerminal>)
.or_else(|| WinConsole::new(io::stdout()).ok().map(|t| Box::new(t) as Box<StdoutTerminal>))
.or_else(|| Some(Box::new(WinConsole::new(io::stdout())) as Box<StdoutTerminal>))
}

/// Terminal color definitions
Expand Down
7 changes: 3 additions & 4 deletions library/test/src/term/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ impl<T: Write + Send + 'static> WinConsole<T> {
}
}

/// Returns `None` whenever the terminal cannot be created for some reason.
pub(crate) fn new(out: T) -> io::Result<WinConsole<T>> {
pub(crate) fn new(out: T) -> WinConsole<T> {
use std::mem::MaybeUninit;

let fg;
Expand All @@ -132,13 +131,13 @@ impl<T: Write + Send + 'static> WinConsole<T> {
bg = color::BLACK;
}
}
Ok(WinConsole {
WinConsole {
buf: out,
def_foreground: fg,
def_background: bg,
foreground: fg,
background: bg,
})
}
}
}

Expand Down

0 comments on commit 3ff0a33

Please sign in to comment.