mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-17 00:02:45 +08:00
Simplify Default
impl for ParseError
By implementing `Default` for `ParseErrorCode`, `ParseError` can just `#[derive(Default)]` instead. Closes #9637.
This commit is contained in:
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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user