Skip to content

Commit

Permalink
Rollup merge of rust-lang#45005 - leodasvacas:inline-eq-slice-into-eq…
Browse files Browse the repository at this point in the history
…, r=jseyfried

Inline eq_slice into str::eq

It's the only use of the function.
  • Loading branch information
kennytm authored Oct 11, 2017
2 parents c0d40a1 + bb74c20 commit 17cacc8
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -1590,7 +1580,6 @@ mod traits {
use cmp::Ordering;
use ops;
use slice::{self, SliceIndex};
use str::eq_slice;

/// Implements ordering of strings.
///
Expand All @@ -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) }
Expand Down

0 comments on commit 17cacc8

Please sign in to comment.