diff --git a/maud/tests/control_structures.rs b/maud/tests/control_structures.rs index 49f27c69..db3a91d1 100644 --- a/maud/tests/control_structures.rs +++ b/maud/tests/control_structures.rs @@ -1,4 +1,3 @@ -#![feature(conservative_impl_trait)] #![feature(plugin)] #![feature(proc_macro)] diff --git a/maud_macros/src/build.rs b/maud_macros/src/build.rs index 97666185..13719571 100644 --- a/maud_macros/src/build.rs +++ b/maud_macros/src/build.rs @@ -34,15 +34,7 @@ impl Builder { /// Reifies the `Builder` into a raw list of statements. pub fn build(mut self) -> TokenStream { let Builder { stmts, .. } = { self.flush(); self }; - - // use a Group here? - let mut tts: Vec = Vec::new(); - for s in stmts.into_iter() { - let i = s.into_iter(); - tts.extend(i); - } - - tts.into_iter().collect() + stmts.into_iter().collect() } /// Pushes a statement, flushing the tail buffer in the process. diff --git a/maud_macros/src/parse.rs b/maud_macros/src/parse.rs index aaece529..2108ce8c 100644 --- a/maud_macros/src/parse.rs +++ b/maud_macros/src/parse.rs @@ -10,6 +10,7 @@ use proc_macro::{ }; use proc_macro::token_stream; +use std::iter; use std::mem; use literalext::LiteralExt; @@ -302,14 +303,14 @@ impl Parser { } fn match_arms(&mut self) -> ParseResult { - let mut arms: Vec = Vec::new(); + let mut arms = Vec::new(); while let Some(arm) = self.match_arm()? { - arms.extend(arm); + arms.push(arm); } Ok(arms.into_iter().collect()) } - fn match_arm(&mut self) -> ParseResult>> { + fn match_arm(&mut self) -> ParseResult> { let mut pat: Vec = Vec::new(); loop { match self.peek2() { @@ -364,8 +365,7 @@ impl Parser { }, None => return self.error("unexpected end of @match arm"), }; - pat.push(body); - Ok(Some(pat)) + Ok(Some(pat.into_iter().chain(iter::once(body)).collect())) } /// Parses and renders a `@let` expression.