]> git.lizzy.rs Git - rust.git/commitdiff
Inline eq_slice_() into eq_slice()
authorBjörn Steinbrink <bsteinbr@gmail.com>
Tue, 21 Jul 2015 16:30:18 +0000 (18:30 +0200)
committerBjörn Steinbrink <bsteinbr@gmail.com>
Tue, 21 Jul 2015 16:30:18 +0000 (18:30 +0200)
eq_slice_() used to be a common implementation for two function that
both called it, but of those only eq_slice() is left, so we can as well
directly inline the code.

src/libcore/str/mod.rs

index 5269cce17448229ddc2dd82bc6f1ad29383724ee..4f0b881c5cd604c3ef56040ac8420e50e535a0fa 100644 (file)
@@ -871,12 +871,12 @@ fn next_back(&mut self) -> Option<&'a str> {
 Section: Comparing strings
 */
 
-// share the implementation of the lang-item vs. non-lang-item
-// eq_slice.
+/// Bytewise slice equality
 /// NOTE: This function is (ab)used in rustc::middle::trans::_match
 /// to compare &[u8] byte slices that are not necessarily valid UTF-8.
+#[lang = "str_eq"]
 #[inline]
-fn eq_slice_(a: &str, b: &str) -> bool {
+fn eq_slice(a: &str, b: &str) -> bool {
     // NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
     #[allow(improper_ctypes)]
     extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
@@ -887,15 +887,6 @@ fn eq_slice_(a: &str, b: &str) -> bool {
     }
 }
 
-/// Bytewise slice equality
-/// NOTE: This function is (ab)used in rustc::middle::trans::_match
-/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
-#[lang = "str_eq"]
-#[inline]
-fn eq_slice(a: &str, b: &str) -> bool {
-    eq_slice_(a, b)
-}
-
 /*
 Section: Misc
 */