Skip to content

Commit 88f32d1

Browse files
committed
Remove a couple of isize references from hashmap docs
Also fix a spelling mistake.
1 parent e2746d8 commit 88f32d1

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

src/libstd/collections/hash/map.rs

+27-27
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ impl<K: Hash + Eq, V> HashMap<K, V, RandomState> {
620620
///
621621
/// ```
622622
/// use std::collections::HashMap;
623-
/// let mut map: HashMap<&str, isize> = HashMap::new();
623+
/// let mut map: HashMap<&str, i32> = HashMap::new();
624624
/// ```
625625
#[inline]
626626
#[stable(feature = "rust1", since = "1.0.0")]
@@ -637,7 +637,7 @@ impl<K: Hash + Eq, V> HashMap<K, V, RandomState> {
637637
///
638638
/// ```
639639
/// use std::collections::HashMap;
640-
/// let mut map: HashMap<&str, isize> = HashMap::with_capacity(10);
640+
/// let mut map: HashMap<&str, i32> = HashMap::with_capacity(10);
641641
/// ```
642642
#[inline]
643643
#[stable(feature = "rust1", since = "1.0.0")]
@@ -724,7 +724,7 @@ impl<K, V, S> HashMap<K, V, S>
724724
/// use std::collections::hash_map::RandomState;
725725
///
726726
/// let hasher = RandomState::new();
727-
/// let map: HashMap<isize, isize> = HashMap::with_hasher(hasher);
727+
/// let map: HashMap<i32, i32> = HashMap::with_hasher(hasher);
728728
/// let hasher: &RandomState = map.hasher();
729729
/// ```
730730
#[stable(feature = "hashmap_public_hasher", since = "1.9.0")]
@@ -741,7 +741,7 @@ impl<K, V, S> HashMap<K, V, S>
741741
///
742742
/// ```
743743
/// use std::collections::HashMap;
744-
/// let map: HashMap<isize, isize> = HashMap::with_capacity(100);
744+
/// let map: HashMap<i32, i32> = HashMap::with_capacity(100);
745745
/// assert!(map.capacity() >= 100);
746746
/// ```
747747
#[inline]
@@ -770,7 +770,7 @@ impl<K, V, S> HashMap<K, V, S>
770770
///
771771
/// ```
772772
/// use std::collections::HashMap;
773-
/// let mut map: HashMap<&str, isize> = HashMap::new();
773+
/// let mut map: HashMap<&str, i32> = HashMap::new();
774774
/// map.reserve(10);
775775
/// ```
776776
#[stable(feature = "rust1", since = "1.0.0")]
@@ -849,7 +849,7 @@ impl<K, V, S> HashMap<K, V, S>
849849
/// ```
850850
/// use std::collections::HashMap;
851851
///
852-
/// let mut map: HashMap<isize, isize> = HashMap::with_capacity(100);
852+
/// let mut map: HashMap<i32, i32> = HashMap::with_capacity(100);
853853
/// map.insert(1, 2);
854854
/// map.insert(3, 4);
855855
/// assert!(map.capacity() >= 100);
@@ -1306,7 +1306,7 @@ impl<K, V, S> HashMap<K, V, S>
13061306
/// ```
13071307
/// use std::collections::HashMap;
13081308
///
1309-
/// let mut map: HashMap<isize, isize> = (0..8).map(|x|(x, x*10)).collect();
1309+
/// let mut map: HashMap<i32, i32> = (0..8).map(|x|(x, x*10)).collect();
13101310
/// map.retain(|&k, _| k % 2 == 0);
13111311
/// assert_eq!(map.len(), 4);
13121312
/// ```
@@ -1722,7 +1722,7 @@ impl<K, V, S> IntoIterator for HashMap<K, V, S>
17221722
/// map.insert("c", 3);
17231723
///
17241724
/// // Not possible with .iter()
1725-
/// let vec: Vec<(&str, isize)> = map.into_iter().collect();
1725+
/// let vec: Vec<(&str, i32)> = map.into_iter().collect();
17261726
/// ```
17271727
fn into_iter(self) -> IntoIter<K, V> {
17281728
IntoIter { inner: self.table.into_iter() }
@@ -2786,34 +2786,34 @@ mod test_map {
27862786
assert_eq!(m2.len(), 2);
27872787
}
27882788

2789-
thread_local! { static DROP_VECTOR: RefCell<Vec<isize>> = RefCell::new(Vec::new()) }
2789+
thread_local! { static DROP_VECTOR: RefCell<Vec<i32>> = RefCell::new(Vec::new()) }
27902790

27912791
#[derive(Hash, PartialEq, Eq)]
2792-
struct Dropable {
2792+
struct Droppable {
27932793
k: usize,
27942794
}
27952795

2796-
impl Dropable {
2797-
fn new(k: usize) -> Dropable {
2796+
impl Droppable {
2797+
fn new(k: usize) -> Droppable {
27982798
DROP_VECTOR.with(|slot| {
27992799
slot.borrow_mut()[k] += 1;
28002800
});
28012801

2802-
Dropable { k: k }
2802+
Droppable { k: k }
28032803
}
28042804
}
28052805

2806-
impl Drop for Dropable {
2806+
impl Drop for Droppable {
28072807
fn drop(&mut self) {
28082808
DROP_VECTOR.with(|slot| {
28092809
slot.borrow_mut()[self.k] -= 1;
28102810
});
28112811
}
28122812
}
28132813

2814-
impl Clone for Dropable {
2815-
fn clone(&self) -> Dropable {
2816-
Dropable::new(self.k)
2814+
impl Clone for Droppable {
2815+
fn clone(&self) -> Droppable {
2816+
Droppable::new(self.k)
28172817
}
28182818
}
28192819

@@ -2833,8 +2833,8 @@ mod test_map {
28332833
});
28342834

28352835
for i in 0..100 {
2836-
let d1 = Dropable::new(i);
2837-
let d2 = Dropable::new(i + 100);
2836+
let d1 = Droppable::new(i);
2837+
let d2 = Droppable::new(i + 100);
28382838
m.insert(d1, d2);
28392839
}
28402840

@@ -2845,7 +2845,7 @@ mod test_map {
28452845
});
28462846

28472847
for i in 0..50 {
2848-
let k = Dropable::new(i);
2848+
let k = Droppable::new(i);
28492849
let v = m.remove(&k);
28502850

28512851
assert!(v.is_some());
@@ -2892,8 +2892,8 @@ mod test_map {
28922892
});
28932893

28942894
for i in 0..100 {
2895-
let d1 = Dropable::new(i);
2896-
let d2 = Dropable::new(i + 100);
2895+
let d1 = Droppable::new(i);
2896+
let d2 = Droppable::new(i + 100);
28972897
hm.insert(d1, d2);
28982898
}
28992899

@@ -2943,13 +2943,13 @@ mod test_map {
29432943

29442944
#[test]
29452945
fn test_empty_remove() {
2946-
let mut m: HashMap<isize, bool> = HashMap::new();
2946+
let mut m: HashMap<i32, bool> = HashMap::new();
29472947
assert_eq!(m.remove(&0), None);
29482948
}
29492949

29502950
#[test]
29512951
fn test_empty_entry() {
2952-
let mut m: HashMap<isize, bool> = HashMap::new();
2952+
let mut m: HashMap<i32, bool> = HashMap::new();
29532953
match m.entry(0) {
29542954
Occupied(_) => panic!(),
29552955
Vacant(_) => {}
@@ -2960,7 +2960,7 @@ mod test_map {
29602960

29612961
#[test]
29622962
fn test_empty_iter() {
2963-
let mut m: HashMap<isize, bool> = HashMap::new();
2963+
let mut m: HashMap<i32, bool> = HashMap::new();
29642964
assert_eq!(m.drain().next(), None);
29652965
assert_eq!(m.keys().next(), None);
29662966
assert_eq!(m.values().next(), None);
@@ -3461,7 +3461,7 @@ mod test_map {
34613461
fn test_entry_take_doesnt_corrupt() {
34623462
#![allow(deprecated)] //rand
34633463
// Test for #19292
3464-
fn check(m: &HashMap<isize, ()>) {
3464+
fn check(m: &HashMap<i32, ()>) {
34653465
for k in m.keys() {
34663466
assert!(m.contains_key(k),
34673467
"{} is in keys() but not in the map?", k);
@@ -3570,7 +3570,7 @@ mod test_map {
35703570

35713571
#[test]
35723572
fn test_retain() {
3573-
let mut map: HashMap<isize, isize> = (0..100).map(|x|(x, x*10)).collect();
3573+
let mut map: HashMap<i32, i32> = (0..100).map(|x|(x, x*10)).collect();
35743574

35753575
map.retain(|&k, _| k % 2 == 0);
35763576
assert_eq!(map.len(), 50);

src/libstd/collections/hash/set.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ impl<T, S> HashSet<T, S>
724724
/// use std::collections::HashSet;
725725
///
726726
/// let xs = [1,2,3,4,5,6];
727-
/// let mut set: HashSet<isize> = xs.iter().cloned().collect();
727+
/// let mut set: HashSet<i32> = xs.iter().cloned().collect();
728728
/// set.retain(|&k| k % 2 == 0);
729729
/// assert_eq!(set.len(), 3);
730730
/// ```
@@ -1745,7 +1745,7 @@ mod test_set {
17451745
#[test]
17461746
fn test_retain() {
17471747
let xs = [1, 2, 3, 4, 5, 6];
1748-
let mut set: HashSet<isize> = xs.iter().cloned().collect();
1748+
let mut set: HashSet<i32> = xs.iter().cloned().collect();
17491749
set.retain(|&k| k % 2 == 0);
17501750
assert_eq!(set.len(), 3);
17511751
assert!(set.contains(&2));

0 commit comments

Comments
 (0)