about summary refs log tree commit diff
path: root/library/std/src/sys
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2020-08-20 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2020-08-21 13:17:20 +0200
commit479c23bb493e4ea801c125cfc54e70723a9aeeb5 (patch)
tree0e55f5ac72d4f5665022c17811801add186e7160 /library/std/src/sys
parent32cb8d40eb4382bd67510c0f06fc855063f0fde8 (diff)
downloadrust-479c23bb493e4ea801c125cfc54e70723a9aeeb5.tar.gz
rust-479c23bb493e4ea801c125cfc54e70723a9aeeb5.zip
Remove result type from raw standard streams constructors
Raw standard streams constructors are infallible. Remove unnecessary
result type.
Diffstat (limited to 'library/std/src/sys')
-rw-r--r--library/std/src/sys/cloudabi/stdio.rs14
-rw-r--r--library/std/src/sys/hermit/stdio.rs14
-rw-r--r--library/std/src/sys/sgx/stdio.rs12
-rw-r--r--library/std/src/sys/unix/stdio.rs14
-rw-r--r--library/std/src/sys/unsupported/stdio.rs12
-rw-r--r--library/std/src/sys/vxworks/stdio.rs14
-rw-r--r--library/std/src/sys/wasi/stdio.rs14
-rw-r--r--library/std/src/sys/windows/stdio.rs14
-rw-r--r--library/std/src/sys/windows/stdio_uwp.rs14
9 files changed, 61 insertions, 61 deletions
diff --git a/library/std/src/sys/cloudabi/stdio.rs b/library/std/src/sys/cloudabi/stdio.rs
index 601563c5b1f..d564f4f7f40 100644
--- a/library/std/src/sys/cloudabi/stdio.rs
+++ b/library/std/src/sys/cloudabi/stdio.rs
@@ -6,8 +6,8 @@ pub struct Stdout(());
 pub struct Stderr(());
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        Ok(Stdin(()))
+    pub fn new() -> Stdin {
+        Stdin(())
     }
 }
 
@@ -18,8 +18,8 @@ impl io::Read for Stdin {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout(()))
+    pub fn new() -> Stdout {
+        Stdout(())
     }
 }
 
@@ -37,8 +37,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr(()))
+    pub fn new() -> Stderr {
+        Stderr(())
     }
 }
 
@@ -62,5 +62,5 @@ pub fn is_ebadf(err: &io::Error) -> bool {
 pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
 
 pub fn panic_output() -> Option<impl io::Write> {
-    Stderr::new().ok()
+    Some(Stderr::new())
 }
diff --git a/library/std/src/sys/hermit/stdio.rs b/library/std/src/sys/hermit/stdio.rs
index f3654ee3871..359ea13c2be 100644
--- a/library/std/src/sys/hermit/stdio.rs
+++ b/library/std/src/sys/hermit/stdio.rs
@@ -7,8 +7,8 @@ pub struct Stdout;
 pub struct Stderr;
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        Ok(Stdin)
+    pub fn new() -> Stdin {
+        Stdin
     }
 }
 
@@ -28,8 +28,8 @@ impl io::Read for Stdin {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout)
+    pub fn new() -> Stdout {
+        Stdout
     }
 }
 
@@ -69,8 +69,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr)
+    pub fn new() -> Stderr {
+        Stderr
     }
 }
 
@@ -116,5 +116,5 @@ pub fn is_ebadf(_err: &io::Error) -> bool {
 }
 
 pub fn panic_output() -> Option<impl io::Write> {
-    Stderr::new().ok()
+    Some(Stderr::new())
 }
diff --git a/library/std/src/sys/sgx/stdio.rs b/library/std/src/sys/sgx/stdio.rs
index 716c174bd53..d771a39ea85 100644
--- a/library/std/src/sys/sgx/stdio.rs
+++ b/library/std/src/sys/sgx/stdio.rs
@@ -19,8 +19,8 @@ fn with_std_fd<F: FnOnce(&FileDesc) -> R, R>(fd: abi::Fd, f: F) -> R {
 }
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        Ok(Stdin(()))
+    pub fn new() -> Stdin {
+        Stdin(())
     }
 }
 
@@ -31,8 +31,8 @@ impl io::Read for Stdin {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout(()))
+    pub fn new() -> Stdout {
+        Stdout(())
     }
 }
 
@@ -47,8 +47,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr(()))
+    pub fn new() -> Stderr {
+        Stderr(())
     }
 }
 
diff --git a/library/std/src/sys/unix/stdio.rs b/library/std/src/sys/unix/stdio.rs
index f8353214cbc..bbf5dd65fa5 100644
--- a/library/std/src/sys/unix/stdio.rs
+++ b/library/std/src/sys/unix/stdio.rs
@@ -7,8 +7,8 @@ pub struct Stdout(());
 pub struct Stderr(());
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        Ok(Stdin(()))
+    pub fn new() -> Stdin {
+        Stdin(())
     }
 }
 
@@ -28,8 +28,8 @@ impl io::Read for Stdin {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout(()))
+    pub fn new() -> Stdout {
+        Stdout(())
     }
 }
 
@@ -53,8 +53,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr(()))
+    pub fn new() -> Stderr {
+        Stderr(())
     }
 }
 
@@ -84,5 +84,5 @@ pub fn is_ebadf(err: &io::Error) -> bool {
 pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
 
 pub fn panic_output() -> Option<impl io::Write> {
-    Stderr::new().ok()
+    Some(Stderr::new())
 }
diff --git a/library/std/src/sys/unsupported/stdio.rs b/library/std/src/sys/unsupported/stdio.rs
index 5a4e4505e93..7e60e0712dd 100644
--- a/library/std/src/sys/unsupported/stdio.rs
+++ b/library/std/src/sys/unsupported/stdio.rs
@@ -5,8 +5,8 @@ pub struct Stdout;
 pub struct Stderr;
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        Ok(Stdin)
+    pub fn new() -> Stdin {
+        Stdin
     }
 }
 
@@ -17,8 +17,8 @@ impl io::Read for Stdin {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout)
+    pub fn new() -> Stdout {
+        Stdout
     }
 }
 
@@ -33,8 +33,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr)
+    pub fn new() -> Stderr {
+        Stderr
     }
 }
 
diff --git a/library/std/src/sys/vxworks/stdio.rs b/library/std/src/sys/vxworks/stdio.rs
index 622444ccafd..e99d2d58346 100644
--- a/library/std/src/sys/vxworks/stdio.rs
+++ b/library/std/src/sys/vxworks/stdio.rs
@@ -6,8 +6,8 @@ pub struct Stdout(());
 pub struct Stderr(());
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        Ok(Stdin(()))
+    pub fn new() -> Stdin {
+        Stdin(())
     }
 }
 
@@ -21,8 +21,8 @@ impl io::Read for Stdin {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout(()))
+    pub fn new() -> Stdout {
+        Stdout(())
     }
 }
 
@@ -40,8 +40,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr(()))
+    pub fn new() -> Stderr {
+        Stderr(())
     }
 }
 
@@ -65,5 +65,5 @@ pub fn is_ebadf(err: &io::Error) -> bool {
 pub const STDIN_BUF_SIZE: usize = crate::sys_common::io::DEFAULT_BUF_SIZE;
 
 pub fn panic_output() -> Option<impl io::Write> {
-    Stderr::new().ok()
+    Some(Stderr::new())
 }
diff --git a/library/std/src/sys/wasi/stdio.rs b/library/std/src/sys/wasi/stdio.rs
index 78e3911dc4e..cc27e2ee583 100644
--- a/library/std/src/sys/wasi/stdio.rs
+++ b/library/std/src/sys/wasi/stdio.rs
@@ -7,8 +7,8 @@ pub struct Stdout;
 pub struct Stderr;
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        Ok(Stdin)
+    pub fn new() -> Stdin {
+        Stdin
     }
 
     #[inline]
@@ -33,8 +33,8 @@ impl io::Read for Stdin {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout)
+    pub fn new() -> Stdout {
+        Stdout
     }
 
     #[inline]
@@ -62,8 +62,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr)
+    pub fn new() -> Stderr {
+        Stderr
     }
 
     #[inline]
@@ -98,5 +98,5 @@ pub fn is_ebadf(err: &io::Error) -> bool {
 }
 
 pub fn panic_output() -> Option<impl io::Write> {
-    Stderr::new().ok()
+    Some(Stderr::new())
 }
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<usize> {
 }
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        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<usize> {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout)
+    pub fn new() -> Stdout {
+        Stdout
     }
 }
 
@@ -271,8 +271,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr)
+    pub fn new() -> Stderr {
+        Stderr
     }
 }
 
@@ -291,5 +291,5 @@ pub fn is_ebadf(err: &io::Error) -> bool {
 }
 
 pub fn panic_output() -> Option<impl io::Write> {
-    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<usize> {
 }
 
 impl Stdin {
-    pub fn new() -> io::Result<Stdin> {
-        Ok(Stdin {})
+    pub fn new() -> Stdin {
+        Stdin {}
     }
 }
 
@@ -44,8 +44,8 @@ impl io::Read for Stdin {
 }
 
 impl Stdout {
-    pub fn new() -> io::Result<Stdout> {
-        Ok(Stdout)
+    pub fn new() -> Stdout {
+        Stdout
     }
 }
 
@@ -60,8 +60,8 @@ impl io::Write for Stdout {
 }
 
 impl Stderr {
-    pub fn new() -> io::Result<Stderr> {
-        Ok(Stderr)
+    pub fn new() -> Stderr {
+        Stderr
     }
 }
 
@@ -80,5 +80,5 @@ pub fn is_ebadf(err: &io::Error) -> bool {
 }
 
 pub fn panic_output() -> Option<impl io::Write> {
-    Stderr::new().ok()
+    Some(Stderr::new())
 }