refactor(CommandParseError): remove the display implementation
we want to be able to give additional arguments to the display function later, so this is needed
This commit is contained in:
parent
b8ed0868cb
commit
55b4779964
4 changed files with 33 additions and 11 deletions
|
|
@ -54,16 +54,12 @@ pub enum CommandParseError {
|
|||
Scan(ScanError),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for CommandParseError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
impl CommandParseError {
|
||||
pub(crate) fn message(&self) -> String {
|
||||
match self {
|
||||
CommandParseError::MetaCommand(meta_command_parse_error) => {
|
||||
write!(f, "{meta_command_parse_error}")
|
||||
}
|
||||
CommandParseError::Statement(statement_parse_error) => {
|
||||
write!(f, "{statement_parse_error}")
|
||||
}
|
||||
CommandParseError::Scan(scan_error) => write!(f, "{scan_error:?}"),
|
||||
CommandParseError::MetaCommand(x) => format!("{x}"),
|
||||
CommandParseError::Statement(x) => format!("{x}"),
|
||||
CommandParseError::Scan(x) => format!("{x}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue