diff options
| author | Mark Mansi <markm@cs.wisc.edu> | 2018-01-18 21:17:01 -0600 |
|---|---|---|
| committer | Mark Mansi <markm@cs.wisc.edu> | 2018-01-30 12:32:41 -0600 |
| commit | c33649cd8effaf3e1301ad2d81b053bd90764e32 (patch) | |
| tree | ba31177f8dfd60fa22dce2ccdfa2c33bdbac5c78 /src/libsyntax | |
| parent | bb8110c1fcc33117fbf8bed985c0f472b3816bc3 (diff) | |
| download | rust-c33649cd8effaf3e1301ad2d81b053bd90764e32.tar.gz rust-c33649cd8effaf3e1301ad2d81b053bd90764e32.zip | |
Run rustfmt on quoted.rs
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/tt/quoted.rs | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index f8ae8726bc1..13764ebfca1 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -241,7 +241,7 @@ pub fn parse( /// - `sess`: the parsing session. Any errors will be emitted to this session. fn parse_tree<I>( tree: tokenstream::TokenTree, - trees: &mut I, + trees: &mut Peekable<I>, expect_matchers: bool, sess: &ParseSess, ) -> TokenTree @@ -339,15 +339,21 @@ fn kleene_op(token: &token::Token) -> Option<KleeneOp> { /// - Ok(Ok(op)) 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<I>(input: &mut I, span: Span) -> Result<Result<KleeneOp, (token::Token, Span)>, Span> - where I: Iterator<Item = tokenstream::TokenTree>, +fn parse_kleene_op<I>( + input: &mut I, + span: Span, +) -> Result<Result<KleeneOp, (token::Token, Span)>, Span> +where + I: Iterator<Item = tokenstream::TokenTree>, { match input.next() { Some(tokenstream::TokenTree::Token(span, tok)) => match kleene_op(&tok) { Some(op) => Ok(Ok(op)), None => Ok(Err((tok, span))), - } - tree => Err(tree.as_ref().map(tokenstream::TokenTree::span).unwrap_or(span)), + }, + tree => Err(tree.as_ref() + .map(tokenstream::TokenTree::span) + .unwrap_or(span)), } } @@ -363,9 +369,13 @@ fn parse_kleene_op<I>(input: &mut I, span: Span) -> Result<Result<KleeneOp, (tok /// session `sess`. If the next one (or possibly two) tokens in `input` correspond to a Kleene /// operator and separator, then a tuple with `(separator, KleeneOp)` is returned. Otherwise, an /// error with the appropriate span is emitted to `sess` and a dummy value is returned. -fn parse_sep_and_kleene_op<I>(input: &mut Peekable<I>, span: Span, sess: &ParseSess) - -> (Option<token::Token>, KleeneOp) - where I: Iterator<Item = tokenstream::TokenTree>, +fn parse_sep_and_kleene_op<I>( + input: &mut Peekable<I>, + span: Span, + sess: &ParseSess, +) -> (Option<token::Token>, KleeneOp) +where + I: Iterator<Item = tokenstream::TokenTree>, { // We basically look at two token trees here, denoted as #1 and #2 below let span = match parse_kleene_op(input, span) { @@ -415,12 +425,13 @@ fn parse_sep_and_kleene_op<I>(input: &mut Peekable<I>, span: Span, sess: &ParseS // #2 is not a token at all :( Err(span) => span, - } + }, // #1 is not a token Err(span) => span, }; - sess.span_diagnostic.span_err(span, "expected one of: `*`, `+`, or `?`"); + sess.span_diagnostic + .span_err(span, "expected one of: `*`, `+`, or `?`"); (None, KleeneOp::ZeroOrMore) } |
