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

Commit 26e67d8

Browse files
committed
Use mark() in the implementation of location()
1 parent 1c031a6 commit 26e67d8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/error.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,7 @@ impl de::Error for Error {
179179

180180
impl ErrorImpl {
181181
fn location(&self) -> Option<Location> {
182-
match self {
183-
ErrorImpl::Message(_, Some(pos)) => Some(Location::from_mark(pos.mark)),
184-
ErrorImpl::Libyaml(err) => Some(Location::from_mark(err.mark())),
185-
ErrorImpl::Shared(err) => err.location(),
186-
_ => None,
187-
}
182+
self.mark().map(Location::from_mark)
188183
}
189184

190185
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
@@ -201,6 +196,7 @@ impl ErrorImpl {
201196
ErrorImpl::Message(_, Some(Pos { mark, path: _ }))
202197
| ErrorImpl::RecursionLimitExceeded(mark)
203198
| ErrorImpl::UnknownAnchor(mark) => Some(*mark),
199+
ErrorImpl::Libyaml(err) => Some(err.mark()),
204200
ErrorImpl::Shared(err) => err.mark(),
205201
_ => None,
206202
}

0 commit comments

Comments
 (0)