Skip to content

Commit 9fcbde8

Browse files
authored
Rollup merge of rust-lang#103340 - RalfJung:winconsole, r=thomcc
WinConsole::new is not actually fallible I just noticed this while reading the code for other reasons. r? `@thomcc`
2 parents a4eabab + 3ff0a33 commit 9fcbde8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

library/test/src/term.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub(crate) fn stdout() -> Option<Box<StdoutTerminal>> {
3939
pub(crate) fn stdout() -> Option<Box<StdoutTerminal>> {
4040
TerminfoTerminal::new(io::stdout())
4141
.map(|t| Box::new(t) as Box<StdoutTerminal>)
42-
.or_else(|| WinConsole::new(io::stdout()).ok().map(|t| Box::new(t) as Box<StdoutTerminal>))
42+
.or_else(|| Some(Box::new(WinConsole::new(io::stdout())) as Box<StdoutTerminal>))
4343
}
4444

4545
/// Terminal color definitions

library/test/src/term/win.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ impl<T: Write + Send + 'static> WinConsole<T> {
113113
}
114114
}
115115

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

120119
let fg;
@@ -132,13 +131,13 @@ impl<T: Write + Send + 'static> WinConsole<T> {
132131
bg = color::BLACK;
133132
}
134133
}
135-
Ok(WinConsole {
134+
WinConsole {
136135
buf: out,
137136
def_foreground: fg,
138137
def_background: bg,
139138
foreground: fg,
140139
background: bg,
141-
})
140+
}
142141
}
143142
}
144143

0 commit comments

Comments
 (0)