.map_err(|()| err!())
}
// `vis` is optional
- "vis" => match input.eat_vis() {
- Some(vis) => Ok(Some(vis)),
- None => Ok(None),
- },
+ "vis" => Ok(input.eat_vis()),
_ => Err(ExpandError::UnexpectedToken),
};
return tt_result.map(|it| it.map(Fragment::Tokens)).into();
}
fn eat_vis(&mut self) -> Option<tt::TokenTree> {
- let mut fork = self.clone();
- match fork.expect_fragment(Visibility) {
- ExpandResult { value: tt, err: None } => {
- *self = fork;
- tt
- }
- ExpandResult { value: _, err: Some(_) } => None,
- }
+ self.expect_fragment(Visibility).value
}
fn eat_char(&mut self, c: char) -> Option<tt::TokenTree> {