internal: reduce coupling
tt is a data structure, data structures cant' go wrong, they shouldn't have the knowledge that the world outside of them has all kinds of errors.
This commit is contained in:
@@ -39,17 +39,11 @@ pub enum ExpandError {
|
||||
UnexpectedToken,
|
||||
BindingError(String),
|
||||
ConversionError,
|
||||
ProcMacroError(tt::ExpansionError),
|
||||
// FXME: no way mbe should know about proc macros.
|
||||
UnresolvedProcMacro,
|
||||
Other(String),
|
||||
}
|
||||
|
||||
impl From<tt::ExpansionError> for ExpandError {
|
||||
fn from(it: tt::ExpansionError) -> Self {
|
||||
ExpandError::ProcMacroError(it)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for ExpandError {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
@@ -57,7 +51,6 @@ impl fmt::Display for ExpandError {
|
||||
ExpandError::UnexpectedToken => f.write_str("unexpected token in input"),
|
||||
ExpandError::BindingError(e) => f.write_str(e),
|
||||
ExpandError::ConversionError => f.write_str("could not convert tokens"),
|
||||
ExpandError::ProcMacroError(e) => e.fmt(f),
|
||||
ExpandError::UnresolvedProcMacro => f.write_str("unresolved proc macro"),
|
||||
ExpandError::Other(e) => f.write_str(e),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user