mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-03 23:11:14 -03:00
Simplify Default impl for ParseError
By implementing `Default` for `ParseErrorCode`, `ParseError` can just `#[derive(Default)]` instead. Closes #9637.
This commit is contained in:
committed by
Mahmoud Al-Qudsi
parent
a16abf22d9
commit
14d6b1c3de
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user