Skip to content

Commit

Permalink
fix outdated docs
Browse files Browse the repository at this point in the history
Conflicts:
	src/libstd/collections/mod.rs
  • Loading branch information
Gankra authored and Manishearth committed Feb 6, 2015
1 parent 3a9b4e5 commit e15538d
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 88 deletions.
10 changes: 5 additions & 5 deletions src/libcollections/binary_heap.rs
Expand Up @@ -183,7 +183,7 @@ impl<T: Ord> BinaryHeap<T> {
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
/// heap.push(4u);
/// heap.push(4);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> BinaryHeap<T> { BinaryHeap { data: vec![] } }
Expand All @@ -198,7 +198,7 @@ impl<T: Ord> BinaryHeap<T> {
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::with_capacity(10);
/// heap.push(4u);
/// heap.push(4);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn with_capacity(capacity: usize) -> BinaryHeap<T> {
Expand Down Expand Up @@ -292,7 +292,7 @@ impl<T: Ord> BinaryHeap<T> {
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::with_capacity(100);
/// assert!(heap.capacity() >= 100);
/// heap.push(4u);
/// heap.push(4);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn capacity(&self) -> usize { self.data.capacity() }
Expand All @@ -315,7 +315,7 @@ impl<T: Ord> BinaryHeap<T> {
/// let mut heap = BinaryHeap::new();
/// heap.reserve_exact(100);
/// assert!(heap.capacity() >= 100);
/// heap.push(4u);
/// heap.push(4);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve_exact(&mut self, additional: usize) {
Expand All @@ -336,7 +336,7 @@ impl<T: Ord> BinaryHeap<T> {
/// let mut heap = BinaryHeap::new();
/// heap.reserve(100);
/// assert!(heap.capacity() >= 100);
/// heap.push(4u);
/// heap.push(4);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn reserve(&mut self, additional: usize) {
Expand Down
56 changes: 28 additions & 28 deletions src/libcollections/btree/map.rs
Expand Up @@ -173,7 +173,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut a = BTreeMap::new();
/// a.insert(1u, "a");
/// a.insert(1, "a");
/// a.clear();
/// assert!(a.is_empty());
/// ```
Expand Down Expand Up @@ -203,7 +203,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1u, "a");
/// map.insert(1, "a");
/// assert_eq!(map.get(&1), Some(&"a"));
/// assert_eq!(map.get(&2), None);
/// ```
Expand Down Expand Up @@ -235,7 +235,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1u, "a");
/// map.insert(1, "a");
/// assert_eq!(map.contains_key(&1), true);
/// assert_eq!(map.contains_key(&2), false);
/// ```
Expand All @@ -255,7 +255,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1u, "a");
/// map.insert(1, "a");
/// match map.get_mut(&1) {
/// Some(x) => *x = "b",
/// None => (),
Expand Down Expand Up @@ -317,7 +317,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// assert_eq!(map.insert(37u, "a"), None);
/// assert_eq!(map.insert(37, "a"), None);
/// assert_eq!(map.is_empty(), false);
///
/// map.insert(37, "b");
Expand Down Expand Up @@ -429,7 +429,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1u, "a");
/// map.insert(1, "a");
/// assert_eq!(map.remove(&1), Some("a"));
/// assert_eq!(map.remove(&1), None);
/// ```
Expand Down Expand Up @@ -1170,16 +1170,16 @@ impl<K, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1u, "a");
/// map.insert(2u, "b");
/// map.insert(3u, "c");
/// map.insert(1, "a");
/// map.insert(2, "b");
/// map.insert(3, "c");
///
/// for (key, value) in map.iter() {
/// println!("{}: {}", key, value);
/// }
///
/// let (first_key, first_value) = map.iter().next().unwrap();
/// assert_eq!((*first_key, *first_value), (1u, "a"));
/// assert_eq!((*first_key, *first_value), (1, "a"));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<K, V> {
Expand All @@ -1203,9 +1203,9 @@ impl<K, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert("a", 1u);
/// map.insert("b", 2u);
/// map.insert("c", 3u);
/// map.insert("a", 1);
/// map.insert("b", 2);
/// map.insert("c", 3);
///
/// // add 10 to the value if the key isn't "a"
/// for (key, value) in map.iter_mut() {
Expand Down Expand Up @@ -1235,9 +1235,9 @@ impl<K, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut map = BTreeMap::new();
/// map.insert(1u, "a");
/// map.insert(2u, "b");
/// map.insert(3u, "c");
/// map.insert(1, "a");
/// map.insert(2, "b");
/// map.insert(3, "c");
///
/// for (key, value) in map.into_iter() {
/// println!("{}: {}", key, value);
Expand All @@ -1264,11 +1264,11 @@ impl<K, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut a = BTreeMap::new();
/// a.insert(1u, "a");
/// a.insert(2u, "b");
/// a.insert(1, "a");
/// a.insert(2, "b");
///
/// let keys: Vec<usize> = a.keys().cloned().collect();
/// assert_eq!(keys, vec![1u,2,]);
/// assert_eq!(keys, vec![1,2,]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn keys<'a>(&'a self) -> Keys<'a, K, V> {
Expand All @@ -1286,8 +1286,8 @@ impl<K, V> BTreeMap<K, V> {
/// use std::collections::BTreeMap;
///
/// let mut a = BTreeMap::new();
/// a.insert(1u, "a");
/// a.insert(2u, "b");
/// a.insert(1, "a");
/// a.insert(2, "b");
///
/// let values: Vec<&str> = a.values().cloned().collect();
/// assert_eq!(values, vec!["a","b"]);
Expand All @@ -1309,7 +1309,7 @@ impl<K, V> BTreeMap<K, V> {
///
/// let mut a = BTreeMap::new();
/// assert_eq!(a.len(), 0);
/// a.insert(1u, "a");
/// a.insert(1, "a");
/// assert_eq!(a.len(), 1);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand All @@ -1324,7 +1324,7 @@ impl<K, V> BTreeMap<K, V> {
///
/// let mut a = BTreeMap::new();
/// assert!(a.is_empty());
/// a.insert(1u, "a");
/// a.insert(1, "a");
/// assert!(!a.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1474,13 +1474,13 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// use std::collections::Bound::{Included, Unbounded};
///
/// let mut map = BTreeMap::new();
/// map.insert(3u, "a");
/// map.insert(5u, "b");
/// map.insert(8u, "c");
/// map.insert(3, "a");
/// map.insert(5, "b");
/// map.insert(8, "c");
/// for (&key, &value) in map.range(Included(&4), Included(&8)) {
/// println!("{}: {}", key, value);
/// }
/// assert_eq!(Some((&5u, &"b")), map.range(Included(&4), Unbounded).next());
/// assert_eq!(Some((&5, &"b")), map.range(Included(&4), Unbounded).next());
/// ```
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
Expand Down Expand Up @@ -1539,7 +1539,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// }
/// }
///
/// assert_eq!(count["a"], 3u);
/// assert_eq!(count["a"], 3);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn entry(&mut self, mut key: K) -> Entry<K, V> {
Expand Down
52 changes: 26 additions & 26 deletions src/libcollections/btree/set.rs
Expand Up @@ -114,14 +114,14 @@ impl<T> BTreeSet<T> {
/// ```
/// use std::collections::BTreeSet;
///
/// let set: BTreeSet<usize> = [1u, 2, 3, 4].iter().map(|&x| x).collect();
/// let set: BTreeSet<usize> = [1, 2, 3, 4].iter().map(|&x| x).collect();
///
/// for x in set.iter() {
/// println!("{}", x);
/// }
///
/// let v: Vec<usize> = set.iter().map(|&x| x).collect();
/// assert_eq!(v, vec![1u,2,3,4]);
/// assert_eq!(v, vec![1,2,3,4]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn iter(&self) -> Iter<T> {
Expand All @@ -135,10 +135,10 @@ impl<T> BTreeSet<T> {
/// ```
/// use std::collections::BTreeSet;
///
/// let set: BTreeSet<usize> = [1u, 2, 3, 4].iter().map(|&x| x).collect();
/// let set: BTreeSet<usize> = [1, 2, 3, 4].iter().map(|&x| x).collect();
///
/// let v: Vec<usize> = set.into_iter().collect();
/// assert_eq!(v, vec![1u,2,3,4]);
/// assert_eq!(v, vec![1,2,3,4]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn into_iter(self) -> IntoIter<T> {
Expand All @@ -162,13 +162,13 @@ impl<T: Ord> BTreeSet<T> {
/// use std::collections::Bound::{Included, Unbounded};
///
/// let mut set = BTreeSet::new();
/// set.insert(3u);
/// set.insert(5u);
/// set.insert(8u);
/// set.insert(3);
/// set.insert(5);
/// set.insert(8);
/// for &elem in set.range(Included(&4), Included(&8)) {
/// println!("{}", elem);
/// }
/// assert_eq!(Some(&5u), set.range(Included(&4), Unbounded).next());
/// assert_eq!(Some(&5), set.range(Included(&4), Unbounded).next());
/// ```
#[unstable(feature = "collections",
reason = "matches collection reform specification, waiting for dust to settle")]
Expand All @@ -189,15 +189,15 @@ impl<T: Ord> BTreeSet<T> {
/// use std::collections::BTreeSet;
///
/// let mut a = BTreeSet::new();
/// a.insert(1u);
/// a.insert(2u);
/// a.insert(1);
/// a.insert(2);
///
/// let mut b = BTreeSet::new();
/// b.insert(2u);
/// b.insert(3u);
/// b.insert(2);
/// b.insert(3);
///
/// let diff: Vec<usize> = a.difference(&b).cloned().collect();
/// assert_eq!(diff, vec![1u]);
/// assert_eq!(diff, vec![1]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn difference<'a>(&'a self, other: &'a BTreeSet<T>) -> Difference<'a, T> {
Expand All @@ -212,15 +212,15 @@ impl<T: Ord> BTreeSet<T> {
/// use std::collections::BTreeSet;
///
/// let mut a = BTreeSet::new();
/// a.insert(1u);
/// a.insert(2u);
/// a.insert(1);
/// a.insert(2);
///
/// let mut b = BTreeSet::new();
/// b.insert(2u);
/// b.insert(3u);
/// b.insert(2);
/// b.insert(3);
///
/// let sym_diff: Vec<usize> = a.symmetric_difference(&b).cloned().collect();
/// assert_eq!(sym_diff, vec![1u,3]);
/// assert_eq!(sym_diff, vec![1,3]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn symmetric_difference<'a>(&'a self, other: &'a BTreeSet<T>)
Expand All @@ -236,15 +236,15 @@ impl<T: Ord> BTreeSet<T> {
/// use std::collections::BTreeSet;
///
/// let mut a = BTreeSet::new();
/// a.insert(1u);
/// a.insert(2u);
/// a.insert(1);
/// a.insert(2);
///
/// let mut b = BTreeSet::new();
/// b.insert(2u);
/// b.insert(3u);
/// b.insert(2);
/// b.insert(3);
///
/// let intersection: Vec<usize> = a.intersection(&b).cloned().collect();
/// assert_eq!(intersection, vec![2u]);
/// assert_eq!(intersection, vec![2]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn intersection<'a>(&'a self, other: &'a BTreeSet<T>)
Expand All @@ -260,13 +260,13 @@ impl<T: Ord> BTreeSet<T> {
/// use std::collections::BTreeSet;
///
/// let mut a = BTreeSet::new();
/// a.insert(1u);
/// a.insert(1);
///
/// let mut b = BTreeSet::new();
/// b.insert(2u);
/// b.insert(2);
///
/// let union: Vec<usize> = a.union(&b).cloned().collect();
/// assert_eq!(union, vec![1u,2]);
/// assert_eq!(union, vec![1,2]);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn union<'a>(&'a self, other: &'a BTreeSet<T>) -> Union<'a, T> {
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/ring_buf.rs
Expand Up @@ -388,7 +388,7 @@ impl<T> RingBuf<T> {
/// use std::collections::RingBuf;
///
/// let mut buf = RingBuf::with_capacity(15);
/// buf.extend(0u..4);
/// buf.extend(0..4);
/// assert_eq!(buf.capacity(), 15);
/// buf.shrink_to_fit();
/// assert!(buf.capacity() >= 4);
Expand Down

0 comments on commit e15538d

Please sign in to comment.