Simplify Default impl for ParseError

By implementing `Default` for `ParseErrorCode`, `ParseError` can just
`#[derive(Default)]` instead.

Closes #9637.
This commit is contained in:
AsukaMinato 2023-03-05 12:09:11 +09:00 committed by Mahmoud Al-Qudsi
parent a16abf22d9
commit 14d6b1c3de

View File

@ -359,7 +359,13 @@ fn keyword_from_string<'a>(s: impl Into<&'a wstr>) -> ParseKeyword {
ParseKeyword::from(s)
}
#[derive(Clone)]
impl Default for ParseErrorCode {
fn default() -> Self {
ParseErrorCode::none
}
}
#[derive(Clone, Default)]
pub struct ParseError {
/// Text of the error.
pub text: WString,
@ -370,17 +376,6 @@ pub struct ParseError {
pub source_length: usize,
}
impl Default for ParseError {
fn default() -> ParseError {
ParseError {
text: L!("").to_owned(),
code: ParseErrorCode::none,
source_start: 0,
source_length: 0,
}
}
}
impl ParseError {
/// Return a string describing the error, suitable for presentation to the user. If
/// is_interactive is true, the offending line with a caret is printed as well.