diff options
| author | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-12-27 14:58:24 +0300 |
|---|---|---|
| committer | Aleksey Kladov <aleksey.kladov@gmail.com> | 2021-12-28 17:00:55 +0300 |
| commit | 23ce31e836389fce24ae63993ef78e3716d1d012 (patch) | |
| tree | e40a5efb816f3613b8d76418793f7412b1aa87c5 | |
| parent | 4d3ad04a9c84ac70c15465c1124c4d4dbef3b772 (diff) | |
| download | rust-23ce31e836389fce24ae63993ef78e3716d1d012.tar.gz rust-23ce31e836389fce24ae63993ef78e3716d1d012.zip | |
simplify
| -rw-r--r-- | crates/mbe/src/expander/matcher.rs | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs index b2d3f038f54..8d192b53f85 100644 --- a/crates/mbe/src/expander/matcher.rs +++ b/crates/mbe/src/expander/matcher.rs @@ -726,10 +726,7 @@ fn match_meta_var(kind: &str, input: &mut TtIter) -> ExpandResult<Option<Fragmen .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(); @@ -899,14 +896,7 @@ impl<'a> TtIter<'a> { } 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> { |
