diff options
| author | bors <bors@rust-lang.org> | 2014-04-22 15:31:33 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-04-22 15:31:33 -0700 |
| commit | 09bfb92fdc3ccff42dfcf91b0af368f88dc3e446 (patch) | |
| tree | 4026e10b5fecb970294b899b86dc8593c809923a /src/libstd/str.rs | |
| parent | 1e3358903d1ca150856183a696701b7dc7ceb568 (diff) | |
| parent | 49d60b851cbff5339df53fde64a2accd993c4f1a (diff) | |
| download | rust-09bfb92fdc3ccff42dfcf91b0af368f88dc3e446.tar.gz rust-09bfb92fdc3ccff42dfcf91b0af368f88dc3e446.zip | |
auto merge of #13674 : pcwalton/rust/more-str-inlines, r=alexcrichton
Was killing performance of selector matching in Servo. r? @alexcrichton (or anyone)
Diffstat (limited to 'src/libstd/str.rs')
| -rw-r--r-- | src/libstd/str.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 672442bb931..9d91545bc12 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -227,6 +227,7 @@ impl CharEq for char { #[inline] fn matches(&self, c: char) -> bool { *self == c } + #[inline] fn only_ascii(&self) -> bool { (*self as uint) < 128 } } @@ -234,6 +235,7 @@ impl<'a> CharEq for |char|: 'a -> bool { #[inline] fn matches(&self, c: char) -> bool { (*self)(c) } + #[inline] fn only_ascii(&self) -> bool { false } } @@ -241,6 +243,7 @@ impl CharEq for extern "Rust" fn(char) -> bool { #[inline] fn matches(&self, c: char) -> bool { (*self)(c) } + #[inline] fn only_ascii(&self) -> bool { false } } @@ -250,6 +253,7 @@ impl<'a, C: CharEq> CharEq for &'a [C] { self.iter().any(|m| m.matches(c)) } + #[inline] fn only_ascii(&self) -> bool { self.iter().all(|m| m.only_ascii()) } |
