Skip to content

Commit f86719a

Browse files
committed
Some more cleanup in libsyntax::ext::tt::quoted
1 parent ab7d75d commit f86719a

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/libsyntax/ext/tt/quoted.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,16 @@ pub fn parse(
249249
/// - `sess`: the parsing session. Any errors will be emitted to this session.
250250
/// - `features`, `attrs`: language feature flags and attributes so that we know whether to use
251251
/// unstable features or not.
252-
fn parse_tree<I>(
252+
fn parse_tree(
253253
tree: tokenstream::TokenTree,
254-
trees: &mut Peekable<I>,
254+
trees: &mut Peekable<impl Iterator<Item = tokenstream::TokenTree>>,
255255
expect_matchers: bool,
256256
sess: &ParseSess,
257257
features: &Features,
258258
attrs: &[ast::Attribute],
259259
edition: Edition,
260260
macro_node_id: NodeId,
261-
) -> TokenTree
262-
where
263-
I: Iterator<Item = tokenstream::TokenTree>,
264-
{
261+
) -> TokenTree {
265262
// Depending on what `tree` is, we could be parsing different parts of a macro
266263
match tree {
267264
// `tree` is a `$` token. Look at the next token in `trees`
@@ -365,10 +362,10 @@ fn kleene_op(token: &Token) -> Option<KleeneOp> {
365362
/// - Ok(Ok((op, span))) if the next token tree is a KleeneOp
366363
/// - Ok(Err(tok, span)) if the next token tree is a token but not a KleeneOp
367364
/// - Err(span) if the next token tree is not a token
368-
fn parse_kleene_op<I>(input: &mut I, span: Span) -> Result<Result<(KleeneOp, Span), Token>, Span>
369-
where
370-
I: Iterator<Item = tokenstream::TokenTree>,
371-
{
365+
fn parse_kleene_op(
366+
input: &mut impl Iterator<Item = tokenstream::TokenTree>,
367+
span: Span,
368+
) -> Result<Result<(KleeneOp, Span), Token>, Span> {
372369
match input.next() {
373370
Some(tokenstream::TokenTree::Token(token)) => match kleene_op(&token) {
374371
Some(op) => Ok(Ok((op, token.span))),
@@ -378,7 +375,7 @@ where
378375
.as_ref()
379376
.map(tokenstream::TokenTree::span)
380377
.unwrap_or(span)),
381-
}
378+
}
382379
}
383380

384381
/// Attempt to parse a single Kleene star, possibly with a separator.

0 commit comments

Comments
 (0)