Skip to content

Commit 50ef207

Browse files
author
Jorge Aparicio
committed
libunicode: fix fallout
1 parent d3f5c13 commit 50ef207

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/libunicode/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
html_playground_url = "http://play.rust-lang.org/")]
3030
#![no_std]
3131
#![feature(globs)]
32+
#![feature(unboxed_closures)]
3233

3334
extern crate core;
3435

src/libunicode/u_str.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use tables::grapheme::GraphemeCat;
2929

3030
/// An iterator over the words of a string, separated by a sequence of whitespace
3131
/// FIXME: This should be opaque
32-
pub type Words<'a> = Filter<&'a str, CharSplits<'a, |char|:'a -> bool>, fn(&&str) -> bool>;
32+
pub type Words<'a> = Filter<&'a str, CharSplits<'a, fn(char) -> bool>, fn(&&str) -> bool>;
3333

3434
/// Methods for Unicode string slices
3535
pub trait UnicodeStrPrelude for Sized? {
@@ -143,8 +143,9 @@ impl UnicodeStrPrelude for str {
143143
#[inline]
144144
fn words(&self) -> Words {
145145
fn is_not_empty(s: &&str) -> bool { !s.is_empty() }
146-
let f = |c: char| c.is_whitespace();
147-
self.split(f).filter(is_not_empty)
146+
fn is_whitespace(c: char) -> bool { c.is_whitespace() }
147+
148+
self.split(is_whitespace).filter(is_not_empty)
148149
}
149150

150151
#[inline]
@@ -165,12 +166,12 @@ impl UnicodeStrPrelude for str {
165166

166167
#[inline]
167168
fn trim_left(&self) -> &str {
168-
self.trim_left_chars(|c: char| c.is_whitespace())
169+
self.trim_left_chars(|&: c: char| c.is_whitespace())
169170
}
170171

171172
#[inline]
172173
fn trim_right(&self) -> &str {
173-
self.trim_right_chars(|c: char| c.is_whitespace())
174+
self.trim_right_chars(|&: c: char| c.is_whitespace())
174175
}
175176
}
176177

0 commit comments

Comments
 (0)