From bb74c20a5d2594cab6d9416c2ed2cc8bd45fc956 Mon Sep 17 00:00:00 2001 From: "leonardo.yvens" Date: Mon, 2 Oct 2017 22:04:23 -0300 Subject: [PATCH] Inline eq_slice into str::eq It's the only use of the function. --- src/libcore/str/mod.rs | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 0af9fcf0a3d3b..670c2afa66f85 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1405,16 +1405,6 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> { #[allow(deprecated)] 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) }