]> git.lizzy.rs Git - rust.git/commitdiff
libgetopts: use unboxed closures in `each_split_within`
authorJorge Aparicio <japaricious@gmail.com>
Sat, 6 Dec 2014 17:26:58 +0000 (12:26 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Sat, 13 Dec 2014 22:03:46 +0000 (17:03 -0500)
src/libgetopts/lib.rs

index a47fab124c3b117a87b671ff329d2c707a37083a..79c435f01e4e6b71b5053a64d943bb550570fc23 100644 (file)
@@ -87,6 +87,7 @@
        html_playground_url = "http://play.rust-lang.org/")]
 #![feature(globs, phase)]
 #![feature(import_shadowing)]
+#![feature(unboxed_closures)]
 #![deny(missing_docs)]
 
 #[cfg(test)] #[phase(plugin, link)] extern crate log;
@@ -867,8 +868,9 @@ impl Copy for LengthLimit {}
 ///
 /// Panics during iteration if the string contains a non-whitespace
 /// sequence longer than the limit.
-fn each_split_within<'a>(ss: &'a str, lim: uint, it: |&'a str| -> bool)
-                     -> bool {
+fn each_split_within<F>(ss: &str, lim: uint, mut it: F) -> bool where
+    F: FnMut(&str) -> bool
+{
     // Just for fun, let's write this as a state machine:
 
     let mut slice_start = 0;