1
Fork 0

libcore: Remove all uses of ~str from libcore.

[breaking-change]
This commit is contained in:
Patrick Walton 2014-05-19 23:19:56 -07:00
parent 5633d4641f
commit e878721d70
110 changed files with 868 additions and 792 deletions

View file

@ -25,7 +25,7 @@ use iter::range;
use num::Saturating;
use option::{None, Option, Some};
use raw::Repr;
use slice::{ImmutableVector, Vector};
use slice::ImmutableVector;
use slice;
use uint;
@ -596,20 +596,6 @@ pub fn eq_slice(a: &str, b: &str) -> bool {
eq_slice_(a, b)
}
/// Bytewise string equality
#[cfg(not(test))]
#[lang="uniq_str_eq"]
#[inline]
pub fn eq(a: &~str, b: &~str) -> bool {
eq_slice(*a, *b)
}
#[cfg(test)]
#[inline]
pub fn eq(a: &~str, b: &~str) -> bool {
eq_slice(*a, *b)
}
/*
Section: Misc
*/
@ -976,11 +962,6 @@ pub mod traits {
}
}
impl TotalOrd for ~str {
#[inline]
fn cmp(&self, other: &~str) -> Ordering { self.as_slice().cmp(&other.as_slice()) }
}
impl<'a> Eq for &'a str {
#[inline]
fn eq(&self, other: & &'a str) -> bool {
@ -990,36 +971,17 @@ pub mod traits {
fn ne(&self, other: & &'a str) -> bool { !(*self).eq(other) }
}
impl Eq for ~str {
#[inline]
fn eq(&self, other: &~str) -> bool {
eq_slice((*self), (*other))
}
}
impl<'a> TotalEq for &'a str {}
impl TotalEq for ~str {}
impl<'a> Ord for &'a str {
#[inline]
fn lt(&self, other: & &'a str) -> bool { self.cmp(other) == Less }
}
impl Ord for ~str {
#[inline]
fn lt(&self, other: &~str) -> bool { self.cmp(other) == Less }
}
impl<'a, S: Str> Equiv<S> for &'a str {
#[inline]
fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
}
impl<'a, S: Str> Equiv<S> for ~str {
#[inline]
fn equiv(&self, other: &S) -> bool { eq_slice(*self, other.as_slice()) }
}
}
#[cfg(test)]
@ -1036,11 +998,6 @@ impl<'a> Str for &'a str {
fn as_slice<'a>(&'a self) -> &'a str { *self }
}
impl<'a> Str for ~str {
#[inline]
fn as_slice<'a>(&'a self) -> &'a str { let s: &'a str = *self; s }
}
impl<'a> Container for &'a str {
#[inline]
fn len(&self) -> uint {
@ -1048,11 +1005,6 @@ impl<'a> Container for &'a str {
}
}
impl Container for ~str {
#[inline]
fn len(&self) -> uint { self.as_slice().len() }
}
/// Methods for string slices
pub trait StrSlice<'a> {
/// Returns true if one string contains another