Refactor stderr_prints_nothing into a more modular function

This commit is contained in:
Jethro Beekman
2018-08-27 09:57:51 -07:00
parent 367e783e6f
commit 030b1ed7f7
7 changed files with 28 additions and 29 deletions

View File

@@ -10,14 +10,13 @@
use fmt;
use io::prelude::*;
use sys::stdio::{Stderr, stderr_prints_nothing};
use sys::stdio::panic_output;
use thread;
pub fn dumb_print(args: fmt::Arguments) {
if stderr_prints_nothing() {
return
if let Some(mut out) = panic_output() {
let _ = out.write_fmt(args);
}
let _ = Stderr::new().map(|mut stderr| stderr.write_fmt(args));
}
// Other platforms should use the appropriate platform-specific mechanism for