diff options
| author | kennytm <kennytm@gmail.com> | 2017-10-12 16:14:23 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2017-10-13 01:58:38 +0800 |
| commit | 4f83c359b86930ecc391cdeff553869c503e61b0 (patch) | |
| tree | 33358ed2e8bc861f9a06b451c8d92947ef2f3ee5 /src | |
| parent | 445bbde7844eacb3de968e2584db2d44e6c4cbab (diff) | |
| parent | bb74c20a5d2594cab6d9416c2ed2cc8bd45fc956 (diff) | |
Rollup merge of #45005 - leodasvacas:inline-eq-slice-into-eq, r=jseyfried
Inline eq_slice into str::eq It's the only use of the function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/str/mod.rs | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 0af9fcf0a3d..670c2afa66f 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1406,16 +1406,6 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> { impl<'a> FusedIterator for LinesAny<'a> {} /* -Section: Comparing strings -*/ - -/// Bytewise slice equality -#[inline] -fn eq_slice(a: &str, b: &str) -> bool { - a.as_bytes() == b.as_bytes() -} - -/* Section: UTF-8 validation */ @@ -1590,7 +1580,6 @@ mod traits { use cmp::Ordering; use ops; use slice::{self, SliceIndex}; - use str::eq_slice; /// Implements ordering of strings. /// @@ -1611,7 +1600,7 @@ mod traits { impl PartialEq for str { #[inline] fn eq(&self, other: &str) -> bool { - eq_slice(self, other) + self.as_bytes() == other.as_bytes() } #[inline] fn ne(&self, other: &str) -> bool { !(*self).eq(other) } |
