Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Use mark() in the implementation of location()
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Jul 30, 2022
1 parent 1c031a6 commit 26e67d8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,7 @@ impl de::Error for Error {

impl ErrorImpl {
fn location(&self) -> Option<Location> {
match self {
ErrorImpl::Message(_, Some(pos)) => Some(Location::from_mark(pos.mark)),
ErrorImpl::Libyaml(err) => Some(Location::from_mark(err.mark())),
ErrorImpl::Shared(err) => err.location(),
_ => None,
}
self.mark().map(Location::from_mark)
}

fn source(&self) -> Option<&(dyn error::Error + 'static)> {
Expand All @@ -201,6 +196,7 @@ impl ErrorImpl {
ErrorImpl::Message(_, Some(Pos { mark, path: _ }))
| ErrorImpl::RecursionLimitExceeded(mark)
| ErrorImpl::UnknownAnchor(mark) => Some(*mark),
ErrorImpl::Libyaml(err) => Some(err.mark()),
ErrorImpl::Shared(err) => err.mark(),
_ => None,
}
Expand Down

0 comments on commit 26e67d8

Please sign in to comment.