]> git.lizzy.rs Git - rust.git/commitdiff
libregex: use unboxed closures
authorJorge Aparicio <japaricious@gmail.com>
Sun, 7 Dec 2014 16:14:43 +0000 (11:14 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sat, 13 Dec 2014 22:03:46 +0000 (17:03 -0500)
src/libregex/parse.rs

index f7ea83a8a383590bf5354e6d410cbcce6c8da290..ccbd53c4f2a889f56faa154a5462938b734ceb4c 100644 (file)
@@ -888,8 +888,9 @@ fn alternate(&mut self, mut from: uint) -> Result<(), Error> {
     // build_from combines all AST elements starting at 'from' in the
     // parser's stack using 'mk' to combine them. If any such element is not an
     // AST then it is popped off the stack and ignored.
-    fn build_from(&mut self, from: uint, mk: |Ast, Ast| -> Ast)
-                 -> Result<Ast, Error> {
+    fn build_from<F>(&mut self, from: uint, mut mk: F) -> Result<Ast, Error> where
+        F: FnMut(Ast, Ast) -> Ast,
+    {
         if from >= self.stack.len() {
             return self.err("Empty group or alternate not allowed.")
         }