diff options
| author | Brian Anderson <banderson@mozilla.com> | 2016-09-14 17:15:48 +0000 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2016-09-30 14:02:53 -0700 |
| commit | a4c328812997540c82f5039d346d0b30bc1feac4 (patch) | |
| tree | 69427c145feba36c3cc4d5fab672fac300931a81 /src/libstd | |
| parent | 183b2ddce4771df3bcfe36eb229a1791fe4b0f8f (diff) | |
| download | rust-a4c328812997540c82f5039d346d0b30bc1feac4.tar.gz rust-a4c328812997540c82f5039d346d0b30bc1feac4.zip | |
Change the sigs of set_print/set_panic to allow restoring the default objects
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/io/stdio.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index 89cb9909956..6421595a009 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -593,11 +593,11 @@ impl<'a> Write for StderrLock<'a> { with a more general mechanism", issue = "0")] #[doc(hidden)] -pub fn set_panic(sink: Box<Write + Send>) -> Option<Box<Write + Send>> { +pub fn set_panic(sink: Option<Box<Write + Send>>) -> Option<Box<Write + Send>> { use panicking::LOCAL_STDERR; use mem; LOCAL_STDERR.with(move |slot| { - mem::replace(&mut *slot.borrow_mut(), Some(sink)) + mem::replace(&mut *slot.borrow_mut(), sink) }).and_then(|mut s| { let _ = s.flush(); Some(s) @@ -617,10 +617,10 @@ pub fn set_panic(sink: Box<Write + Send>) -> Option<Box<Write + Send>> { with a more general mechanism", issue = "0")] #[doc(hidden)] -pub fn set_print(sink: Box<Write + Send>) -> Option<Box<Write + Send>> { +pub fn set_print(sink: Option<Box<Write + Send>>) -> Option<Box<Write + Send>> { use mem; LOCAL_STDOUT.with(move |slot| { - mem::replace(&mut *slot.borrow_mut(), Some(sink)) + mem::replace(&mut *slot.borrow_mut(), sink) }).and_then(|mut s| { let _ = s.flush(); Some(s) |
