diff options
| author | Leo Testard <leo.testard@gmail.com> | 2016-05-19 00:38:08 +0200 |
|---|---|---|
| committer | Leo Testard <leo.testard@gmail.com> | 2016-05-24 11:21:37 +0200 |
| commit | 7d521445fd47d8403b63c36b712d0238b62a8771 (patch) | |
| tree | cc7b95ab564fcb5cf299d691e6b7cca475d9304c /src/libsyntax/ext | |
| parent | eb364e9c2986350a5313e18bae15d7f98d49388e (diff) | |
| download | rust-7d521445fd47d8403b63c36b712d0238b62a8771.tar.gz rust-7d521445fd47d8403b63c36b712d0238b62a8771.zip | |
Avoid iterating two times over the list of LHSes.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 36d705f3596..3522c8863cf 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -291,17 +291,16 @@ pub fn compile<'cx>(cx: &'cx mut ExtCtxt, let lhses = match **argument_map.get(&lhs_nm.name).unwrap() { MatchedSeq(ref s, _) => { s.iter().map(|m| match **m { - MatchedNonterminal(NtTT(ref tt)) => (**tt).clone(), + MatchedNonterminal(NtTT(ref tt)) => { + valid &= check_lhs_nt_follows(cx, tt); + (**tt).clone() + } _ => cx.span_bug(def.span, "wrong-structured lhs") }).collect() } _ => cx.span_bug(def.span, "wrong-structured lhs") }; - for lhs in &lhses { - valid &= check_lhs_nt_follows(cx, lhs); - } - let rhses = match **argument_map.get(&rhs_nm.name).unwrap() { MatchedSeq(ref s, _) => { s.iter().map(|m| match **m { |
