diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index 66cd22dfb08..1f75daa7bde 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -29,6 +29,7 @@ html_playground_url = "http://play.rust-lang.org/")] #![no_std] #![feature(globs)] +#![feature(unboxed_closures)] extern crate core; diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 33e4df3ca36..80311137b01 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -29,7 +29,7 @@ use tables::grapheme::GraphemeCat; /// An iterator over the words of a string, separated by a sequence of whitespace /// FIXME: This should be opaque -pub type Words<'a> = Filter<&'a str, CharSplits<'a, |char|:'a -> bool>, fn(&&str) -> bool>; +pub type Words<'a> = Filter<&'a str, CharSplits<'a, fn(char) -> bool>, fn(&&str) -> bool>; /// Methods for Unicode string slices pub trait UnicodeStrPrelude for Sized? { @@ -143,8 +143,9 @@ impl UnicodeStrPrelude for str { #[inline] fn words(&self) -> Words { fn is_not_empty(s: &&str) -> bool { !s.is_empty() } - let f = |c: char| c.is_whitespace(); - self.split(f).filter(is_not_empty) + fn is_whitespace(c: char) -> bool { c.is_whitespace() } + + self.split(is_whitespace).filter(is_not_empty) } #[inline] @@ -165,12 +166,12 @@ impl UnicodeStrPrelude for str { #[inline] fn trim_left(&self) -> &str { - self.trim_left_chars(|c: char| c.is_whitespace()) + self.trim_left_chars(|&: c: char| c.is_whitespace()) } #[inline] fn trim_right(&self) -> &str { - self.trim_right_chars(|c: char| c.is_whitespace()) + self.trim_right_chars(|&: c: char| c.is_whitespace()) } }