From 3ff0a33a8343f8f9fe494d161b451d82889b6232 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 21 Oct 2022 12:18:33 +0200 Subject: [PATCH] WinConsole::new is not actually fallible --- library/test/src/term.rs | 2 +- library/test/src/term/win.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/library/test/src/term.rs b/library/test/src/term.rs index b256ab7b8f828..a14b0d4f5a962 100644 --- a/library/test/src/term.rs +++ b/library/test/src/term.rs @@ -39,7 +39,7 @@ pub(crate) fn stdout() -> Option> { pub(crate) fn stdout() -> Option> { TerminfoTerminal::new(io::stdout()) .map(|t| Box::new(t) as Box) - .or_else(|| WinConsole::new(io::stdout()).ok().map(|t| Box::new(t) as Box)) + .or_else(|| Some(Box::new(WinConsole::new(io::stdout())) as Box)) } /// Terminal color definitions diff --git a/library/test/src/term/win.rs b/library/test/src/term/win.rs index 4bdbd6ee75f52..55020141a827d 100644 --- a/library/test/src/term/win.rs +++ b/library/test/src/term/win.rs @@ -113,8 +113,7 @@ impl WinConsole { } } - /// Returns `None` whenever the terminal cannot be created for some reason. - pub(crate) fn new(out: T) -> io::Result> { + pub(crate) fn new(out: T) -> WinConsole { use std::mem::MaybeUninit; let fg; @@ -132,13 +131,13 @@ impl WinConsole { bg = color::BLACK; } } - Ok(WinConsole { + WinConsole { buf: out, def_foreground: fg, def_background: bg, foreground: fg, background: bg, - }) + } } }