simplify
This commit is contained in:
parent
4d3ad04a9c
commit
23ce31e836
@ -726,10 +726,7 @@ fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragmen
|
|||||||
.map_err(|()| err!())
|
.map_err(|()| err!())
|
||||||
}
|
}
|
||||||
// `vis` is optional
|
// `vis` is optional
|
||||||
"vis" => match input.eat_vis() {
|
"vis" => Ok(input.eat_vis()),
|
||||||
Some(vis) => Ok(Some(vis)),
|
|
||||||
None => Ok(None),
|
|
||||||
},
|
|
||||||
_ => Err(ExpandError::UnexpectedToken),
|
_ => Err(ExpandError::UnexpectedToken),
|
||||||
};
|
};
|
||||||
return tt_result.map(|it| it.map(Fragment::Tokens)).into();
|
return tt_result.map(|it| it.map(Fragment::Tokens)).into();
|
||||||
@ -899,14 +896,7 @@ fn expect_lifetime(&mut self) -> Result<tt::TokenTree, ()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn eat_vis(&mut self) -> Option<tt::TokenTree> {
|
fn eat_vis(&mut self) -> Option<tt::TokenTree> {
|
||||||
let mut fork = self.clone();
|
self.expect_fragment(Visibility).value
|
||||||
match fork.expect_fragment(Visibility) {
|
|
||||||
ExpandResult { value: tt, err: None } => {
|
|
||||||
*self = fork;
|
|
||||||
tt
|
|
||||||
}
|
|
||||||
ExpandResult { value: _, err: Some(_) } => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn eat_char(&mut self, c: char) -> Option<tt::TokenTree> {
|
fn eat_char(&mut self, c: char) -> Option<tt::TokenTree> {
|
||||||
|
Loading…
Reference in New Issue
Block a user