Merge #1896
1896: remove obsolete TOOD r=matklad a=matklad Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
efcbca9559
@ -52,6 +52,9 @@ pub(crate) struct Rule {
|
||||
|
||||
impl MacroRules {
|
||||
pub fn parse(tt: &tt::Subtree) -> Result<MacroRules, ParseError> {
|
||||
// Note: this parsing can be implemented using mbe machinery itself, by
|
||||
// matching against `$($lhs:tt => $rhs:tt);*` pattern, but implementing
|
||||
// manually seems easier.
|
||||
let mut src = TtIter::new(tt);
|
||||
let mut rules = Vec::new();
|
||||
while src.len() > 0 {
|
||||
@ -64,6 +67,11 @@ pub fn parse(tt: &tt::Subtree) -> Result<MacroRules, ParseError> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for rule in rules.iter() {
|
||||
validate(&rule.lhs)?;
|
||||
}
|
||||
|
||||
Ok(MacroRules { rules })
|
||||
}
|
||||
pub fn expand(&self, tt: &tt::Subtree) -> Result<tt::Subtree, ExpandError> {
|
||||
@ -77,7 +85,6 @@ fn parse(src: &mut TtIter) -> Result<Rule, ParseError> {
|
||||
.expect_subtree()
|
||||
.map_err(|()| ParseError::Expected("expected subtree".to_string()))?
|
||||
.clone();
|
||||
validate(&lhs)?;
|
||||
lhs.delimiter = tt::Delimiter::None;
|
||||
src.expect_char('=').map_err(|()| ParseError::Expected("expected `=`".to_string()))?;
|
||||
src.expect_char('>').map_err(|()| ParseError::Expected("expected `>`".to_string()))?;
|
||||
|
@ -142,7 +142,6 @@ fn is_boolean_literal(lit: &tt::Literal) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
///TOOD: impl for slice iter
|
||||
fn parse_repeat(src: &mut TtIter) -> Result<(Option<Separator>, RepeatKind), ExpandError> {
|
||||
let mut separator = Separator::Puncts(SmallVec::new());
|
||||
for tt in src {
|
||||
|
@ -34,7 +34,7 @@ fn no_todo() {
|
||||
return;
|
||||
}
|
||||
let text = std::fs::read_to_string(e.path()).unwrap();
|
||||
if text.contains("TODO") {
|
||||
if text.contains("TODO") || text.contains("TOOD") {
|
||||
panic!(
|
||||
"\nTODO markers should not be commited to the master branch,\n\
|
||||
use FIXME instead\n\
|
||||
|
Loading…
Reference in New Issue
Block a user