Skip to content

Commit 4fa8efe

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 164743 b: refs/heads/try c: d3f5c13 h: refs/heads/master i: 164741: 0d38642 164739: 4c01702 164735: 8b6b89c v: v3
1 parent 733a1f9 commit 4fa8efe

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: f8f2c7a9537c7f333b242f616aefb75a83860927
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 8443b09e361b96d1f9b7f45a65ed0d31c0e86e70
5-
refs/heads/try: aa921b61622a6dc08d5c70cb6a217b1f6d304aac
5+
refs/heads/try: d3f5c1397c5012ce9bb022c0320c958c9fdc1208
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/libcore/str.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use mem;
3131
use num::Int;
3232
use option::Option;
3333
use option::Option::{None, Some};
34+
use ops::FnMut;
3435
use ptr::RawPtr;
3536
use raw::{Repr, Slice};
3637
use slice::{mod, SlicePrelude};
@@ -136,15 +137,7 @@ impl CharEq for char {
136137
fn only_ascii(&self) -> bool { (*self as uint) < 128 }
137138
}
138139

139-
impl<'a> CharEq for |char|: 'a -> bool {
140-
#[inline]
141-
fn matches(&mut self, c: char) -> bool { (*self)(c) }
142-
143-
#[inline]
144-
fn only_ascii(&self) -> bool { false }
145-
}
146-
147-
impl CharEq for extern "Rust" fn(char) -> bool {
140+
impl<F> CharEq for F where F: FnMut(char) -> bool {
148141
#[inline]
149142
fn matches(&mut self, c: char) -> bool { (*self)(c) }
150143

@@ -2142,11 +2135,11 @@ impl StrPrelude for str {
21422135

21432136
#[inline]
21442137
fn trim_chars<C: CharEq>(&self, mut to_trim: C) -> &str {
2145-
let cur = match self.find(|c: char| !to_trim.matches(c)) {
2138+
let cur = match self.find(|&mut: c: char| !to_trim.matches(c)) {
21462139
None => "",
21472140
Some(i) => unsafe { self.slice_unchecked(i, self.len()) }
21482141
};
2149-
match cur.rfind(|c: char| !to_trim.matches(c)) {
2142+
match cur.rfind(|&mut: c: char| !to_trim.matches(c)) {
21502143
None => "",
21512144
Some(i) => {
21522145
let right = cur.char_range_at(i).next;
@@ -2157,15 +2150,15 @@ impl StrPrelude for str {
21572150

21582151
#[inline]
21592152
fn trim_left_chars<C: CharEq>(&self, mut to_trim: C) -> &str {
2160-
match self.find(|c: char| !to_trim.matches(c)) {
2153+
match self.find(|&mut: c: char| !to_trim.matches(c)) {
21612154
None => "",
21622155
Some(first) => unsafe { self.slice_unchecked(first, self.len()) }
21632156
}
21642157
}
21652158

21662159
#[inline]
21672160
fn trim_right_chars<C: CharEq>(&self, mut to_trim: C) -> &str {
2168-
match self.rfind(|c: char| !to_trim.matches(c)) {
2161+
match self.rfind(|&mut: c: char| !to_trim.matches(c)) {
21692162
None => "",
21702163
Some(last) => {
21712164
let next = self.char_range_at(last).next;

0 commit comments

Comments
 (0)