From 479c23bb493e4ea801c125cfc54e70723a9aeeb5 Mon Sep 17 00:00:00 2001 From: Tomasz Miąsko Date: Thu, 20 Aug 2020 00:00:00 +0000 Subject: Remove result type from raw standard streams constructors Raw standard streams constructors are infallible. Remove unnecessary result type. --- library/std/src/sys/windows/stdio.rs | 14 +++++++------- library/std/src/sys/windows/stdio_uwp.rs | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'library/std/src/sys/windows') diff --git a/library/std/src/sys/windows/stdio.rs b/library/std/src/sys/windows/stdio.rs index c84896296ec..b2e5458c0d2 100644 --- a/library/std/src/sys/windows/stdio.rs +++ b/library/std/src/sys/windows/stdio.rs @@ -131,8 +131,8 @@ fn write_u16s(handle: c::HANDLE, data: &[u16]) -> io::Result { } impl Stdin { - pub fn new() -> io::Result { - Ok(Stdin { surrogate: 0 }) + pub fn new() -> Stdin { + Stdin { surrogate: 0 } } } @@ -255,8 +255,8 @@ fn utf16_to_utf8(utf16: &[u16], utf8: &mut [u8]) -> io::Result { } impl Stdout { - pub fn new() -> io::Result { - Ok(Stdout) + pub fn new() -> Stdout { + Stdout } } @@ -271,8 +271,8 @@ impl io::Write for Stdout { } impl Stderr { - pub fn new() -> io::Result { - Ok(Stderr) + pub fn new() -> Stderr { + Stderr } } @@ -291,5 +291,5 @@ pub fn is_ebadf(err: &io::Error) -> bool { } pub fn panic_output() -> Option { - Stderr::new().ok() + Some(Stderr::new()) } diff --git a/library/std/src/sys/windows/stdio_uwp.rs b/library/std/src/sys/windows/stdio_uwp.rs index 5bdabf6d4b7..0016f5dcd01 100644 --- a/library/std/src/sys/windows/stdio_uwp.rs +++ b/library/std/src/sys/windows/stdio_uwp.rs @@ -30,8 +30,8 @@ fn write(handle_id: c::DWORD, data: &[u8]) -> io::Result { } impl Stdin { - pub fn new() -> io::Result { - Ok(Stdin {}) + pub fn new() -> Stdin { + Stdin {} } } @@ -44,8 +44,8 @@ impl io::Read for Stdin { } impl Stdout { - pub fn new() -> io::Result { - Ok(Stdout) + pub fn new() -> Stdout { + Stdout } } @@ -60,8 +60,8 @@ impl io::Write for Stdout { } impl Stderr { - pub fn new() -> io::Result { - Ok(Stderr) + pub fn new() -> Stderr { + Stderr } } @@ -80,5 +80,5 @@ pub fn is_ebadf(err: &io::Error) -> bool { } pub fn panic_output() -> Option { - Stderr::new().ok() + Some(Stderr::new()) } -- cgit 1.4.1-3-g733a5