libunicode: fix fallout
This commit is contained in:
parent
d3f5c1397c
commit
50ef207253
2 changed files with 7 additions and 5 deletions
|
@ -29,6 +29,7 @@
|
|||
html_playground_url = "http://play.rust-lang.org/")]
|
||||
#![no_std]
|
||||
#![feature(globs)]
|
||||
#![feature(unboxed_closures)]
|
||||
|
||||
extern crate core;
|
||||
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue