@@ -50,8 +50,8 @@ struct StderrRaw(stdio::Stderr);
5050/// handles is **not** available to raw handles returned from this function.
5151///
5252/// The returned handle has no external synchronization or buffering.
53- fn stdin_raw ( ) -> io :: Result < StdinRaw > {
54- stdio:: Stdin :: new ( ) . map ( StdinRaw )
53+ fn stdin_raw ( ) -> StdinRaw {
54+ StdinRaw ( stdio:: Stdin :: new ( ) )
5555}
5656
5757/// Constructs a new raw handle to the standard output stream of this process.
@@ -63,8 +63,8 @@ fn stdin_raw() -> io::Result<StdinRaw> {
6363///
6464/// The returned handle has no external synchronization or buffering layered on
6565/// top.
66- fn stdout_raw ( ) -> io :: Result < StdoutRaw > {
67- stdio:: Stdout :: new ( ) . map ( StdoutRaw )
66+ fn stdout_raw ( ) -> StdoutRaw {
67+ StdoutRaw ( stdio:: Stdout :: new ( ) )
6868}
6969
7070/// Constructs a new raw handle to the standard error stream of this process.
@@ -74,8 +74,8 @@ fn stdout_raw() -> io::Result<StdoutRaw> {
7474///
7575/// The returned handle has no external synchronization or buffering layered on
7676/// top.
77- fn stderr_raw ( ) -> io :: Result < StderrRaw > {
78- stdio:: Stderr :: new ( ) . map ( StderrRaw )
77+ fn stderr_raw ( ) -> StderrRaw {
78+ StderrRaw ( stdio:: Stderr :: new ( ) )
7979}
8080
8181impl Read for StdinRaw {
@@ -356,11 +356,7 @@ pub fn stdin() -> Stdin {
356356
357357 fn stdin_init ( ) -> Arc < Mutex < BufReader < Maybe < StdinRaw > > > > {
358358 // This must not reentrantly access `INSTANCE`
359- let stdin = match stdin_raw ( ) {
360- Ok ( stdin) => Maybe :: Real ( stdin) ,
361- _ => Maybe :: Fake ,
362- } ;
363-
359+ let stdin = Maybe :: Real ( stdin_raw ( ) ) ;
364360 Arc :: new ( Mutex :: new ( BufReader :: with_capacity ( stdio:: STDIN_BUF_SIZE , stdin) ) )
365361 }
366362}
@@ -602,10 +598,7 @@ pub fn stdout() -> Stdout {
602598
603599 fn stdout_init ( ) -> Arc < ReentrantMutex < RefCell < LineWriter < Maybe < StdoutRaw > > > > > {
604600 // This must not reentrantly access `INSTANCE`
605- let stdout = match stdout_raw ( ) {
606- Ok ( stdout) => Maybe :: Real ( stdout) ,
607- _ => Maybe :: Fake ,
608- } ;
601+ let stdout = Maybe :: Real ( stdout_raw ( ) ) ;
609602 unsafe {
610603 let ret = Arc :: new ( ReentrantMutex :: new ( RefCell :: new ( LineWriter :: new ( stdout) ) ) ) ;
611604 ret. init ( ) ;
@@ -788,9 +781,8 @@ pub fn stderr() -> Stderr {
788781 static INIT : Once = Once :: new ( ) ;
789782 INIT . call_once ( || unsafe {
790783 INSTANCE . init ( ) ;
791- if let Ok ( stderr) = stderr_raw ( ) {
792- * INSTANCE . lock ( ) . borrow_mut ( ) = Maybe :: Real ( stderr) ;
793- }
784+ let stderr = stderr_raw ( ) ;
785+ * INSTANCE . lock ( ) . borrow_mut ( ) = Maybe :: Real ( stderr) ;
794786 } ) ;
795787 Stderr { inner : & INSTANCE }
796788}
0 commit comments