Skip to content

Commit c887429

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 163271 b: refs/heads/snap-stage3 c: d3f5c13 h: refs/heads/master i: 163269: ea3ecad 163267: 2b48533 163263: f16fce8 v: v3
1 parent 442e5b9 commit c887429

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
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 9146a919b616e39e528e4d7100d16eef52f1f852
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: aa921b61622a6dc08d5c70cb6a217b1f6d304aac
4+
refs/heads/snap-stage3: d3f5c1397c5012ce9bb022c0320c958c9fdc1208
55
refs/heads/try: 20cbbffeefc1f35e2ea63afce7b42fbd79611d42
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/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)