Skip to content

Commit 331cfa6

Browse files
committed
Replace FromError with From
As per rust-lang/rust#23879. Signed-off-by: Anders Kaseorg <[email protected]>
1 parent a645c6d commit 331cfa6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/new.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ pub enum Error {
2626
Io(io::Error),
2727
}
2828

29-
impl error::FromError<io::Error> for Error {
30-
fn from_error(err: io::Error) -> Error { Error::Io(err) }
29+
impl From<io::Error> for Error {
30+
fn from(err: io::Error) -> Error { Error::Io(err) }
3131
}
3232

33-
impl error::FromError<Error> for io::Error {
34-
fn from_error(err: Error) -> io::Error {
33+
impl From<Error> for io::Error {
34+
fn from(err: Error) -> io::Error {
3535
match err {
3636
Error::Io(err) => err,
3737
Error::UnexpectedEOF => io::Error::new(io::ErrorKind::Other,
@@ -188,14 +188,14 @@ fn read_full<R: io::Read + ?Sized>(rdr: &mut R, buf: &mut [u8]) -> Result<()> {
188188
Ok(0) => return Err(Error::UnexpectedEOF),
189189
Ok(n) => nread += n,
190190
Err(ref e) if e.kind() == io::ErrorKind::Interrupted => {},
191-
Err(e) => return Err(error::FromError::from_error(e))
191+
Err(e) => return Err(From::from(e))
192192
}
193193
}
194194
Ok(())
195195
}
196196

197197
fn write_all<W: io::Write + ?Sized>(wtr: &mut W, buf: &[u8]) -> Result<()> {
198-
wtr.write_all(buf).map_err(error::FromError::from_error)
198+
wtr.write_all(buf).map_err(From::from)
199199
}
200200

201201
/// Extends `Write` with methods for writing numbers. (For `std::io`.)

0 commit comments

Comments
 (0)