Skip to content

Commit

Permalink
Don’t clone/recreate in impl From<util::CharReadError> for Error
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonSapin committed May 5, 2016
1 parent 085a543 commit b1992f9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/reader/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,8 @@ impl From<util::CharReadError> for Error {
pos: TextPosition::new(),
kind: match e {
UnexpectedEof => ErrorKind::UnexpectedEof,
Utf8(ref reason) => ErrorKind::Utf8(reason.clone()),
Io(ref io_error) =>
ErrorKind::Io(
io::Error::new(
io_error.kind(),
error_description(io_error)
)
),
Utf8(reason) => ErrorKind::Utf8(reason),
Io(io_error) => ErrorKind::Io(io_error),
}
}
}
Expand Down

0 comments on commit b1992f9

Please sign in to comment.