Hoverbear/rust-rosetta — pull request #324 by pfalabella (2014-12-16 09:38:22+00:00)
Title: unboxed closures, proc() removal

Fixes the build after the changes to Iterators to use unboxed closures and proc() removal.

With unboxed closures in their current state, it's becoming hard to return a closure from a function.
These changes exemplify three approaches:

in 100_doors.rs calculate_doors takes the closure as an argument (so it can store it in the returned DoorIter without allocation or lifetime issues)

in function_composition we manually implement a function trait on a named structure. This works, but is probably not going to be un-feature-gated for 1.0 (and therefore it will not work with the official 1.0 release but just with the nightlies). Opening a new issue to decide what to do.

In luhn_test.rs we use a macro instead of trying to return a std::iter::Unfold (that now should contain a closure). The macro expands in place and so does not have lifetime issues.