Skip to content

Clean out deprecated functions and syntax #14360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/libcollections/bitv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use std::cmp;
use std::iter::RandomAccessIterator;
use std::iter::{Rev, Enumerate, Repeat, Map, Zip};
use std::iter::{Enumerate, Repeat, Map, Zip};
use std::ops;
use std::slice;
use std::strbuf::StrBuf;
Expand Down Expand Up @@ -466,12 +466,6 @@ impl Bitv {
Bits {bitv: self, next_idx: 0, end_idx: self.nbits}
}

#[inline]
#[deprecated = "replaced by .iter().rev()"]
pub fn rev_iter<'a>(&'a self) -> Rev<Bits<'a>> {
self.iter().rev()
}

/// Returns `true` if all bits are 0
pub fn none(&self) -> bool {
match self.rep {
Expand Down
19 changes: 0 additions & 19 deletions src/libcollections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
// Backlinks over DList::prev are raw pointers that form a full chain in
// the reverse direction.

use std::iter::Rev;
use std::iter;
use std::mem;
use std::ptr;
Expand Down Expand Up @@ -369,12 +368,6 @@ impl<T> DList<T> {
Items{nelem: self.len(), head: &self.list_head, tail: self.list_tail}
}

#[inline]
#[deprecated = "replaced by .iter().rev()"]
pub fn rev_iter<'a>(&'a self) -> Rev<Items<'a, T>> {
self.iter().rev()
}

/// Provide a forward iterator with mutable references
#[inline]
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
Expand All @@ -390,24 +383,12 @@ impl<T> DList<T> {
}
}

#[inline]
#[deprecated = "replaced by .mut_iter().rev()"]
pub fn mut_rev_iter<'a>(&'a mut self) -> Rev<MutItems<'a, T>> {
self.mut_iter().rev()
}


/// Consume the list into an iterator yielding elements by value
#[inline]
pub fn move_iter(self) -> MoveItems<T> {
MoveItems{list: self}
}

#[inline]
#[deprecated = "replaced by .move_iter().rev()"]
pub fn move_rev_iter(self) -> Rev<MoveItems<T>> {
self.move_iter().rev()
}
}

impl<T: TotalOrd> DList<T> {
Expand Down
12 changes: 1 addition & 11 deletions src/libcollections/ringbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! collections::deque::Deque`.

use std::cmp;
use std::iter::{Rev, RandomAccessIterator};
use std::iter::RandomAccessIterator;

use deque::Deque;

Expand Down Expand Up @@ -190,11 +190,6 @@ impl<T> RingBuf<T> {
Items{index: 0, rindex: self.nelts, lo: self.lo, elts: self.elts.as_slice()}
}

#[deprecated = "replaced by .iter().rev()"]
pub fn rev_iter<'a>(&'a self) -> Rev<Items<'a, T>> {
self.iter().rev()
}

/// Front-to-back iterator which returns mutable values.
pub fn mut_iter<'a>(&'a mut self) -> MutItems<'a, T> {
let start_index = raw_index(self.lo, self.elts.len(), 0);
Expand All @@ -220,11 +215,6 @@ impl<T> RingBuf<T> {
nelts: self.nelts }
}
}

#[deprecated = "replaced by .mut_iter().rev()"]
pub fn mut_rev_iter<'a>(&'a mut self) -> Rev<MutItems<'a, T>> {
self.mut_iter().rev()
}
}

/// RingBuf iterator
Expand Down
16 changes: 1 addition & 15 deletions src/libcollections/smallintmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#![allow(missing_doc)]

use std::iter::{Enumerate, FilterMap, Rev};
use std::iter::{Enumerate, FilterMap};
use std::mem::replace;
use std::{vec, slice};

Expand Down Expand Up @@ -142,16 +142,6 @@ impl<V> SmallIntMap<V> {
}
}

#[deprecated = "replaced by .iter().rev()"]
pub fn rev_iter<'r>(&'r self) -> Rev<Entries<'r, V>> {
self.iter().rev()
}

#[deprecated = "replaced by .mut_iter().rev()"]
pub fn mut_rev_iter<'r>(&'r mut self) -> Rev<MutEntries<'r, V>> {
self.mut_iter().rev()
}

/// Empties the hash map, moving all values into the specified closure
pub fn move_iter(&mut self)
-> FilterMap<(uint, Option<V>), (uint, V),
Expand Down Expand Up @@ -243,8 +233,6 @@ pub struct Entries<'a, T> {

iterator!(impl Entries -> (uint, &'a T), get_ref)
double_ended_iterator!(impl Entries -> (uint, &'a T), get_ref)
#[deprecated = "replaced by Rev<Entries<'a, T>>"]
pub type RevEntries<'a, T> = Rev<Entries<'a, T>>;

pub struct MutEntries<'a, T> {
front: uint,
Expand All @@ -254,8 +242,6 @@ pub struct MutEntries<'a, T> {

iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
double_ended_iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)
#[deprecated = "replaced by Rev<MutEntries<'a, T>"]
pub type RevMutEntries<'a, T> = Rev<MutEntries<'a, T>>;

#[cfg(test)]
mod test_map {
Expand Down
35 changes: 0 additions & 35 deletions src/libcore/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,9 +386,6 @@ pub trait ImmutableVector<'a, T> {
fn slice_to(&self, end: uint) -> &'a [T];
/// Returns an iterator over the vector
fn iter(self) -> Items<'a, T>;
/// Returns a reversed iterator over a vector
#[deprecated = "replaced by .iter().rev()"]
fn rev_iter(self) -> Rev<Items<'a, T>>;
/// Returns an iterator over the subslices of the vector which are
/// separated by elements that match `pred`. The matched element
/// is not contained in the subslices.
Expand All @@ -399,12 +396,6 @@ pub trait ImmutableVector<'a, T> {
/// the subslices.
fn splitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T>;
/// Returns an iterator over the subslices of the vector which are
/// separated by elements that match `pred`. This starts at the
/// end of the vector and works backwards. The matched element is
/// not contained in the subslices.
#[deprecated = "replaced by .split(pred).rev()"]
fn rsplit(self, pred: |&T|: 'a -> bool) -> Rev<Splits<'a, T>>;
/// Returns an iterator over the subslices of the vector which are
/// separated by elements that match `pred` limited to splitting
/// at most `n` times. This starts at the end of the vector and
/// works backwards. The matched element is not contained in the
Expand Down Expand Up @@ -580,12 +571,6 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
}
}

#[inline]
#[deprecated = "replaced by .iter().rev()"]
fn rev_iter(self) -> Rev<Items<'a, T>> {
self.iter().rev()
}

#[inline]
fn split(self, pred: |&T|: 'a -> bool) -> Splits<'a, T> {
Splits {
Expand All @@ -604,12 +589,6 @@ impl<'a,T> ImmutableVector<'a, T> for &'a [T] {
}
}

#[inline]
#[deprecated = "replaced by .split(pred).rev()"]
fn rsplit(self, pred: |&T|: 'a -> bool) -> Rev<Splits<'a, T>> {
self.split(pred).rev()
}

#[inline]
fn rsplitn(self, n: uint, pred: |&T|: 'a -> bool) -> SplitsN<'a, T> {
SplitsN {
Expand Down Expand Up @@ -806,10 +785,6 @@ pub trait MutableVector<'a, T> {
/// Returns a mutable pointer to the last item in the vector.
fn mut_last(self) -> Option<&'a mut T>;

/// Returns a reversed iterator that allows modifying each value
#[deprecated = "replaced by .mut_iter().rev()"]
fn mut_rev_iter(self) -> Rev<MutItems<'a, T>>;

/// Returns an iterator over the mutable subslices of the vector
/// which are separated by elements that match `pred`. The
/// matched element is not contained in the subslices.
Expand Down Expand Up @@ -1045,12 +1020,6 @@ impl<'a,T> MutableVector<'a, T> for &'a mut [T] {
Some(&mut self[len - 1])
}

#[inline]
#[deprecated = "replaced by .mut_iter().rev()"]
fn mut_rev_iter(self) -> Rev<MutItems<'a, T>> {
self.mut_iter().rev()
}

#[inline]
fn mut_split(self, pred: |&T|: 'a -> bool) -> MutSplits<'a, T> {
MutSplits { v: self, pred: pred, finished: false }
Expand Down Expand Up @@ -1354,8 +1323,6 @@ impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
}

iterator!{struct Items -> *T, &'a T}
#[deprecated = "replaced by Rev<Items<'a, T>>"]
pub type RevItems<'a, T> = Rev<Items<'a, T>>;

impl<'a, T> ExactSize<&'a T> for Items<'a, T> {}
impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {}
Expand All @@ -1365,8 +1332,6 @@ impl<'a, T> Clone for Items<'a, T> {
}

iterator!{struct MutItems -> *mut T, &'a mut T}
#[deprecated = "replaced by Rev<MutItems<'a, T>>"]
pub type RevMutItems<'a, T> = Rev<MutItems<'a, T>>;

/// An iterator over the subslices of the vector which are separated
/// by elements that match `pred`.
Expand Down
54 changes: 1 addition & 53 deletions src/libcore/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use cmp::{Eq, TotalEq};
use container::Container;
use default::Default;
use iter::{Filter, Map, Iterator};
use iter::{Rev, DoubleEndedIterator, ExactSize};
use iter::{DoubleEndedIterator, ExactSize};
use iter::range;
use num::Saturating;
use option::{None, Option, Some};
Expand Down Expand Up @@ -174,20 +174,11 @@ impl<'a> DoubleEndedIterator<(uint, char)> for CharOffsets<'a> {
}
}

#[deprecated = "replaced by Rev<Chars<'a>>"]
pub type RevChars<'a> = Rev<Chars<'a>>;

#[deprecated = "replaced by Rev<CharOffsets<'a>>"]
pub type RevCharOffsets<'a> = Rev<CharOffsets<'a>>;

/// External iterator for a string's bytes.
/// Use with the `std::iter` module.
pub type Bytes<'a> =
Map<'a, &'a u8, u8, slice::Items<'a, u8>>;

#[deprecated = "replaced by Rev<Bytes<'a>>"]
pub type RevBytes<'a> = Rev<Bytes<'a>>;

/// An iterator over the substrings of a string, separated by `sep`.
#[deriving(Clone)]
pub struct CharSplits<'a, Sep> {
Expand All @@ -200,9 +191,6 @@ pub struct CharSplits<'a, Sep> {
finished: bool,
}

#[deprecated = "replaced by Rev<CharSplits<'a, Sep>>"]
pub type RevCharSplits<'a, Sep> = Rev<CharSplits<'a, Sep>>;

/// An iterator over the substrings of a string, separated by `sep`,
/// splitting at most `count` times.
#[deriving(Clone)]
Expand Down Expand Up @@ -1080,24 +1068,12 @@ pub trait StrSlice<'a> {
/// ```
fn chars(&self) -> Chars<'a>;

/// Do not use this - it is deprecated.
#[deprecated = "replaced by .chars().rev()"]
fn chars_rev(&self) -> Rev<Chars<'a>>;

/// An iterator over the bytes of `self`
fn bytes(&self) -> Bytes<'a>;

/// Do not use this - it is deprecated.
#[deprecated = "replaced by .bytes().rev()"]
fn bytes_rev(&self) -> Rev<Bytes<'a>>;

/// An iterator over the characters of `self` and their byte offsets.
fn char_indices(&self) -> CharOffsets<'a>;

/// Do not use this - it is deprecated.
#[deprecated = "replaced by .char_indices().rev()"]
fn char_indices_rev(&self) -> Rev<CharOffsets<'a>>;

/// An iterator over substrings of `self`, separated by characters
/// matched by `sep`.
///
Expand Down Expand Up @@ -1159,10 +1135,6 @@ pub trait StrSlice<'a> {
/// ```
fn split_terminator<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep>;

/// Do not use this - it is deprecated.
#[deprecated = "replaced by .split(sep).rev()"]
fn rsplit<Sep: CharEq>(&self, sep: Sep) -> Rev<CharSplits<'a, Sep>>;

/// An iterator over substrings of `self`, separated by characters
/// matched by `sep`, starting from the end of the string.
/// Restricted to splitting at most `count` times.
Expand Down Expand Up @@ -1681,34 +1653,16 @@ impl<'a> StrSlice<'a> for &'a str {
Chars{string: *self}
}

#[inline]
#[deprecated = "replaced by .chars().rev()"]
fn chars_rev(&self) -> RevChars<'a> {
self.chars().rev()
}

#[inline]
fn bytes(&self) -> Bytes<'a> {
self.as_bytes().iter().map(|&b| b)
}

#[inline]
#[deprecated = "replaced by .bytes().rev()"]
fn bytes_rev(&self) -> RevBytes<'a> {
self.bytes().rev()
}

#[inline]
fn char_indices(&self) -> CharOffsets<'a> {
CharOffsets{string: *self, iter: self.chars()}
}

#[inline]
#[deprecated = "replaced by .char_indices().rev()"]
fn char_indices_rev(&self) -> RevCharOffsets<'a> {
self.char_indices().rev()
}

#[inline]
fn split<Sep: CharEq>(&self, sep: Sep) -> CharSplits<'a, Sep> {
CharSplits {
Expand Down Expand Up @@ -1739,12 +1693,6 @@ impl<'a> StrSlice<'a> for &'a str {
}
}

#[inline]
#[deprecated = "replaced by .split(sep).rev()"]
fn rsplit<Sep: CharEq>(&self, sep: Sep) -> RevCharSplits<'a, Sep> {
self.split(sep).rev()
}

#[inline]
fn rsplitn<Sep: CharEq>(&self, sep: Sep, count: uint)
-> CharSplitsN<'a, Sep> {
Expand Down
23 changes: 0 additions & 23 deletions src/librand/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,6 @@ pub trait Rng {
}
}

/// Shuffle a mutable slice in place.
#[deprecated="renamed to `.shuffle`"]
fn shuffle_mut<T>(&mut self, values: &mut [T]) {
self.shuffle(values)
}

/// Randomly sample up to `n` elements from an iterator.
///
/// # Example
Expand Down Expand Up @@ -387,23 +381,6 @@ pub trait SeedableRng<Seed>: Rng {
fn from_seed(seed: Seed) -> Self;
}

/// Create a random number generator with a default algorithm and seed.
///
/// It returns the strongest `Rng` algorithm currently implemented in
/// pure Rust. If you require a specifically seeded `Rng` for
/// consistency over time you should pick one algorithm and create the
/// `Rng` yourself.
///
/// This is a very expensive operation as it has to read randomness
/// from the operating system and use this in an expensive seeding
/// operation. If one does not require high performance generation of
/// random numbers, `task_rng` and/or `random` may be more
/// appropriate.
#[deprecated="use `task_rng` or `StdRng::new`"]
pub fn rng() -> StdRng {
StdRng::new().unwrap()
}

/// The standard RNG. This is designed to be efficient on the current
/// platform.
#[cfg(not(target_word_size="64"))]
Expand Down
Loading