From f86719a111ab4dff770914097af1d6ba76d2f97d Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Wed, 22 May 2019 02:43:46 +0200 Subject: [PATCH] Some more cleanup in libsyntax::ext::tt::quoted --- src/libsyntax/ext/tt/quoted.rs | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index 8475ea8000b2..4920ddfbfe56 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -249,19 +249,16 @@ pub fn parse( /// - `sess`: the parsing session. Any errors will be emitted to this session. /// - `features`, `attrs`: language feature flags and attributes so that we know whether to use /// unstable features or not. -fn parse_tree( +fn parse_tree( tree: tokenstream::TokenTree, - trees: &mut Peekable, + trees: &mut Peekable>, expect_matchers: bool, sess: &ParseSess, features: &Features, attrs: &[ast::Attribute], edition: Edition, macro_node_id: NodeId, -) -> TokenTree -where - I: Iterator, -{ +) -> TokenTree { // Depending on what `tree` is, we could be parsing different parts of a macro match tree { // `tree` is a `$` token. Look at the next token in `trees` @@ -365,10 +362,10 @@ fn kleene_op(token: &Token) -> Option { /// - Ok(Ok((op, span))) if the next token tree is a KleeneOp /// - Ok(Err(tok, span)) if the next token tree is a token but not a KleeneOp /// - Err(span) if the next token tree is not a token -fn parse_kleene_op(input: &mut I, span: Span) -> Result, Span> -where - I: Iterator, -{ +fn parse_kleene_op( + input: &mut impl Iterator, + span: Span, +) -> Result, Span> { match input.next() { Some(tokenstream::TokenTree::Token(token)) => match kleene_op(&token) { Some(op) => Ok(Ok((op, token.span))), @@ -378,7 +375,7 @@ where .as_ref() .map(tokenstream::TokenTree::span) .unwrap_or(span)), - } + } } /// Attempt to parse a single Kleene star, possibly with a separator.