@@ -29,7 +29,7 @@ use tables::grapheme::GraphemeCat;
29
29
30
30
/// An iterator over the words of a string, separated by a sequence of whitespace
31
31
/// 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 > ;
33
33
34
34
/// Methods for Unicode string slices
35
35
pub trait UnicodeStrPrelude for Sized ? {
@@ -143,8 +143,9 @@ impl UnicodeStrPrelude for str {
143
143
#[ inline]
144
144
fn words ( & self ) -> Words {
145
145
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)
148
149
}
149
150
150
151
#[ inline]
@@ -165,12 +166,12 @@ impl UnicodeStrPrelude for str {
165
166
166
167
#[ inline]
167
168
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 ( ) )
169
170
}
170
171
171
172
#[ inline]
172
173
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 ( ) )
174
175
}
175
176
}
176
177
0 commit comments