Skip to content

Commit 09bfb92

Browse files
committed
auto merge of #13674 : pcwalton/rust/more-str-inlines, r=alexcrichton
Was killing performance of selector matching in Servo. r? @alexcrichton (or anyone)
2 parents 1e33589 + 49d60b8 commit 09bfb92

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libstd/str.rs

+4
Original file line numberDiff line numberDiff line change
@@ -227,20 +227,23 @@ impl CharEq for char {
227227
#[inline]
228228
fn matches(&self, c: char) -> bool { *self == c }
229229

230+
#[inline]
230231
fn only_ascii(&self) -> bool { (*self as uint) < 128 }
231232
}
232233

233234
impl<'a> CharEq for |char|: 'a -> bool {
234235
#[inline]
235236
fn matches(&self, c: char) -> bool { (*self)(c) }
236237

238+
#[inline]
237239
fn only_ascii(&self) -> bool { false }
238240
}
239241

240242
impl CharEq for extern "Rust" fn(char) -> bool {
241243
#[inline]
242244
fn matches(&self, c: char) -> bool { (*self)(c) }
243245

246+
#[inline]
244247
fn only_ascii(&self) -> bool { false }
245248
}
246249

@@ -250,6 +253,7 @@ impl<'a, C: CharEq> CharEq for &'a [C] {
250253
self.iter().any(|m| m.matches(c))
251254
}
252255

256+
#[inline]
253257
fn only_ascii(&self) -> bool {
254258
self.iter().all(|m| m.only_ascii())
255259
}

0 commit comments

Comments
 (0)