@@ -50,8 +50,8 @@ struct StderrRaw(stdio::Stderr);
50
50
/// handles is **not** available to raw handles returned from this function.
51
51
///
52
52
/// 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 ( ) )
55
55
}
56
56
57
57
/// Constructs a new raw handle to the standard output stream of this process.
@@ -63,8 +63,8 @@ fn stdin_raw() -> io::Result<StdinRaw> {
63
63
///
64
64
/// The returned handle has no external synchronization or buffering layered on
65
65
/// top.
66
- fn stdout_raw ( ) -> io :: Result < StdoutRaw > {
67
- stdio:: Stdout :: new ( ) . map ( StdoutRaw )
66
+ fn stdout_raw ( ) -> StdoutRaw {
67
+ StdoutRaw ( stdio:: Stdout :: new ( ) )
68
68
}
69
69
70
70
/// Constructs a new raw handle to the standard error stream of this process.
@@ -74,8 +74,8 @@ fn stdout_raw() -> io::Result<StdoutRaw> {
74
74
///
75
75
/// The returned handle has no external synchronization or buffering layered on
76
76
/// top.
77
- fn stderr_raw ( ) -> io :: Result < StderrRaw > {
78
- stdio:: Stderr :: new ( ) . map ( StderrRaw )
77
+ fn stderr_raw ( ) -> StderrRaw {
78
+ StderrRaw ( stdio:: Stderr :: new ( ) )
79
79
}
80
80
81
81
impl Read for StdinRaw {
@@ -356,11 +356,7 @@ pub fn stdin() -> Stdin {
356
356
357
357
fn stdin_init ( ) -> Arc < Mutex < BufReader < Maybe < StdinRaw > > > > {
358
358
// 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 ( ) ) ;
364
360
Arc :: new ( Mutex :: new ( BufReader :: with_capacity ( stdio:: STDIN_BUF_SIZE , stdin) ) )
365
361
}
366
362
}
@@ -602,10 +598,7 @@ pub fn stdout() -> Stdout {
602
598
603
599
fn stdout_init ( ) -> Arc < ReentrantMutex < RefCell < LineWriter < Maybe < StdoutRaw > > > > > {
604
600
// 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 ( ) ) ;
609
602
unsafe {
610
603
let ret = Arc :: new ( ReentrantMutex :: new ( RefCell :: new ( LineWriter :: new ( stdout) ) ) ) ;
611
604
ret. init ( ) ;
@@ -788,9 +781,8 @@ pub fn stderr() -> Stderr {
788
781
static INIT : Once = Once :: new ( ) ;
789
782
INIT . call_once ( || unsafe {
790
783
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) ;
794
786
} ) ;
795
787
Stderr { inner : & INSTANCE }
796
788
}
0 commit comments