diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-04 17:25:18 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-13 17:03:45 -0500 |
| commit | 50ef20725395dcaa3226ee1bfb3f186bb8a2a794 (patch) | |
| tree | d2fd2c04e4ae070af7bcb56726de743ac14fce46 /src/libunicode | |
| parent | d3f5c1397c5012ce9bb022c0320c958c9fdc1208 (diff) | |
| download | rust-50ef20725395dcaa3226ee1bfb3f186bb8a2a794.tar.gz rust-50ef20725395dcaa3226ee1bfb3f186bb8a2a794.zip | |
libunicode: fix fallout
Diffstat (limited to 'src/libunicode')
| -rw-r--r-- | src/libunicode/lib.rs | 1 | ||||
| -rw-r--r-- | src/libunicode/u_str.rs | 11 |
2 files changed, 7 insertions, 5 deletions
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()) } } |
