libgetopts: use unboxed closures in each_split_within

This commit is contained in:
Jorge Aparicio 2014-12-06 12:26:58 -05:00
parent f56f9728e6
commit 04652b57e5

View 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;