Rollup merge of #22311 - lfairy:consistent-fmt, r=alexcrichton
This brings it in line with its namesake in `std::io`. [breaking-change] r? @aturon
This commit is contained in:
@@ -1023,14 +1023,14 @@ pub trait Writer {
|
||||
///
|
||||
/// This function will return any I/O error reported while formatting.
|
||||
fn write_fmt(&mut self, fmt: fmt::Arguments) -> IoResult<()> {
|
||||
// Create a shim which translates a Writer to a fmt::Writer and saves
|
||||
// Create a shim which translates a Writer to a fmt::Write and saves
|
||||
// off I/O errors. instead of discarding them
|
||||
struct Adaptor<'a, T: ?Sized +'a> {
|
||||
inner: &'a mut T,
|
||||
error: IoResult<()>,
|
||||
}
|
||||
|
||||
impl<'a, T: ?Sized + Writer> fmt::Writer for Adaptor<'a, T> {
|
||||
impl<'a, T: ?Sized + Writer> fmt::Write for Adaptor<'a, T> {
|
||||
fn write_str(&mut self, s: &str) -> fmt::Result {
|
||||
match self.inner.write_all(s.as_bytes()) {
|
||||
Ok(()) => Ok(()),
|
||||
|
||||
Reference in New Issue
Block a user