diff options
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/prelude.rs | 3 | ||||
| -rw-r--r-- | src/libcore/result.rs | 26 | ||||
| -rw-r--r-- | src/libcore/slice.rs | 31 | ||||
| -rw-r--r-- | src/libcore/str/mod.rs | 24 |
4 files changed, 0 insertions, 84 deletions
diff --git a/src/libcore/prelude.rs b/src/libcore/prelude.rs index e60bc494081..12f01f2651c 100644 --- a/src/libcore/prelude.rs +++ b/src/libcore/prelude.rs @@ -42,6 +42,3 @@ pub use option::Option::{self, Some, None}; pub use result::Result::{self, Ok, Err}; pub use slice::SliceExt; pub use str::StrExt; - -#[allow(deprecated)] pub use slice::AsSlice; -#[allow(deprecated)] pub use str::Str; diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 03894926293..96f575cc548 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -234,8 +234,6 @@ use fmt; use iter::{Iterator, DoubleEndedIterator, FromIterator, ExactSizeIterator, IntoIterator}; use ops::{FnMut, FnOnce}; use option::Option::{self, None, Some}; -#[allow(deprecated)] -use slice::AsSlice; use slice; /// `Result` is a type that represents either success (`Ok`) or failure (`Err`). @@ -784,30 +782,6 @@ impl<T: fmt::Debug, E> Result<T, E> { } ///////////////////////////////////////////////////////////////////////////// -// Trait implementations -///////////////////////////////////////////////////////////////////////////// - -#[unstable(feature = "core", - reason = "waiting on the stability of the trait itself")] -#[deprecated(since = "1.0.0", - reason = "use inherent method instead")] -#[allow(deprecated)] -impl<T, E> AsSlice<T> for Result<T, E> { - /// Converts from `Result<T, E>` to `&[T]` (without copying) - #[inline] - fn as_slice<'a>(&'a self) -> &'a [T] { - match *self { - Ok(ref x) => slice::ref_slice(x), - Err(_) => { - // work around lack of implicit coercion from fixed-size array to slice - let emp: &[_] = &[]; - emp - } - } - } -} - -///////////////////////////////////////////////////////////////////////////// // The Result Iterators ///////////////////////////////////////////////////////////////////////////// diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 4b1742a4348..102a46a6bc8 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -595,37 +595,6 @@ impl<T> ops::IndexMut<RangeFull> for [T] { // Common traits //////////////////////////////////////////////////////////////////////////////// -/// Data that is viewable as a slice. -#[unstable(feature = "core", - reason = "will be replaced by slice syntax")] -#[deprecated(since = "1.0.0", - reason = "use std::convert::AsRef<[T]> instead")] -pub trait AsSlice<T> { - /// Work with `self` as a slice. - fn as_slice<'a>(&'a self) -> &'a [T]; -} - -#[unstable(feature = "core", reason = "trait is experimental")] -#[allow(deprecated)] -impl<T> AsSlice<T> for [T] { - #[inline(always)] - fn as_slice<'a>(&'a self) -> &'a [T] { self } -} - -#[unstable(feature = "core", reason = "trait is experimental")] -#[allow(deprecated)] -impl<'a, T, U: ?Sized + AsSlice<T>> AsSlice<T> for &'a U { - #[inline(always)] - fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) } -} - -#[unstable(feature = "core", reason = "trait is experimental")] -#[allow(deprecated)] -impl<'a, T, U: ?Sized + AsSlice<T>> AsSlice<T> for &'a mut U { - #[inline(always)] - fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) } -} - #[stable(feature = "rust1", since = "1.0.0")] impl<'a, T> Default for &'a [T] { #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 9c3ab001187..06ea52fd9d6 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -1463,30 +1463,6 @@ mod traits { } } -/// Any string that can be represented as a slice -#[unstable(feature = "core", - reason = "Instead of taking this bound generically, this trait will be \ - replaced with one of slicing syntax (&foo[..]), deref coercions, or \ - a more generic conversion trait")] -#[deprecated(since = "1.0.0", - reason = "use std::convert::AsRef<str> instead")] -pub trait Str { - /// Work with `self` as a slice. - fn as_slice<'a>(&'a self) -> &'a str; -} - -#[allow(deprecated)] -impl Str for str { - #[inline] - fn as_slice<'a>(&'a self) -> &'a str { self } -} - -#[allow(deprecated)] -impl<'a, S: ?Sized> Str for &'a S where S: Str { - #[inline] - fn as_slice(&self) -> &str { Str::as_slice(*self) } -} - /// Methods for string slices #[allow(missing_docs)] #[doc(hidden)] |
