mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
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:
parent
d8a3d6f378
commit
81602f8a5d
6 changed files with 25 additions and 32 deletions
|
@ -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),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue