Skip to content

Commit dd5abb8

Browse files
LucaCappelletti94ayman-sigma
authored andcommitted
Implement core::error::Error for ParserError and TokenizerError (apache#2189)
1 parent 80e0da1 commit dd5abb8

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/parser/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,7 @@ impl fmt::Display for ParserError {
204204
}
205205
}
206206

207-
#[cfg(feature = "std")]
208-
impl std::error::Error for ParserError {}
207+
impl core::error::Error for ParserError {}
209208

210209
// By default, allow expressions up to this deep before erroring
211210
const DEFAULT_REMAINING_DEPTH: usize = 50;

src/tokenizer.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,8 +797,7 @@ impl fmt::Display for TokenizerError {
797797
}
798798
}
799799

800-
#[cfg(feature = "std")]
801-
impl std::error::Error for TokenizerError {}
800+
impl core::error::Error for TokenizerError {}
802801

803802
struct State<'a> {
804803
peekable: Peekable<Chars<'a>>,
@@ -2632,9 +2631,8 @@ mod tests {
26322631
message: "test".into(),
26332632
location: Location { line: 1, column: 1 },
26342633
};
2635-
#[cfg(feature = "std")]
26362634
{
2637-
use std::error::Error;
2635+
use core::error::Error;
26382636
assert!(err.source().is_none());
26392637
}
26402638
assert_eq!(err.to_string(), "test at Line: 1, Column: 1");

0 commit comments

Comments
 (0)