1
Fork 0

Major clean-up of std::io

Use ifaces instead of objs, stop wrapping everything in two (or three)
layers of no-value-added indirection, and remove some of the more
pointless/outdated idioms from the code.
This commit is contained in:
Marijn Haverbeke 2012-01-11 15:15:54 +01:00
parent 807592e99f
commit 34d7f05292
31 changed files with 309 additions and 416 deletions

View file

@ -1,5 +1,6 @@
import core::{vec, uint, str, option, result};
import std::{term, io};
import io::writer_util;
import option::{some, none};
type filename = str;
@ -126,11 +127,11 @@ fn print_diagnostic(topic: str, t: diagnostictype, msg: str) {
io::stdout().write_str(#fmt["%s ", topic]);
}
if term::color_supported() {
term::fg(io::stdout().get_buf_writer(), diagnosticcolor(t));
term::fg(io::stdout(), diagnosticcolor(t));
}
io::stdout().write_str(#fmt["%s:", diagnosticstr(t)]);
if term::color_supported() {
term::reset(io::stdout().get_buf_writer());
term::reset(io::stdout());
}
io::stdout().write_str(#fmt[" %s\n", msg]);
}