Eliminate deprecation warnings

Closes #23.
This commit is contained in:
David Tolnay 2020-01-24 12:59:30 -08:00
parent 80c60941d6
commit 94c358c535
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
1 changed files with 5 additions and 2 deletions

View File

@ -71,8 +71,10 @@ use core::{fmt, mem, ptr, slice, str};
pub fn write<W: io::Write, V: Integer>(mut wr: W, value: V) -> io::Result<usize> {
let mut buf = Buffer::new();
let s = buf.format(value);
try!(wr.write_all(s.as_bytes()));
Ok(s.len())
match wr.write_all(s.as_bytes()) {
Ok(()) => Ok(s.len()),
Err(e) => Err(e),
}
}
/// Write integer to an `fmt::Write`.
@ -114,6 +116,7 @@ impl Buffer {
/// This is a cheap operation; you don't need to worry about reusing buffers
/// for efficiency.
#[inline]
#[allow(deprecated)]
pub fn new() -> Buffer {
Buffer {
bytes: unsafe { mem::uninitialized() },