Shrink mbe::ExpandError and mbe::ParseError

This commit is contained in:
Lukas Wirth 2022-02-03 17:25:24 +01:00
parent 2310908df7
commit 2ad71f1350
8 changed files with 78 additions and 92 deletions

View file

@ -6,15 +6,6 @@ use tt::buffer::TokenBuffer;
use crate::{to_parser_input::to_parser_input, ExpandError, ExpandResult};
macro_rules! err {
() => {
ExpandError::BindingError(format!(""))
};
($($tt:tt)*) => {
ExpandError::BindingError(format!($($tt)*))
};
}
#[derive(Debug, Clone)]
pub(crate) struct TtIter<'a> {
pub(crate) inner: std::slice::Iter<'a, tt::TokenTree>,
@ -115,7 +106,7 @@ impl<'a> TtIter<'a> {
}
let err = if error || !cursor.is_root() {
Some(err!("expected {:?}", entry_point))
Some(ExpandError::BindingError(format!("expected {entry_point:?}").into()))
} else {
None
};