Skip to content

Commit 01d7b8c

Browse files
author
Toby Scrace
committed
Correct small typos in map.rs.
This just corrects a couple of typos in doc comments, and changes some to conform to the Rust guidelines.
1 parent 3bf41da commit 01d7b8c

File tree

1 file changed

+23
-23
lines changed
  • src/libstd/collections/hash

1 file changed

+23
-23
lines changed

src/libstd/collections/hash/map.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -76,7 +76,7 @@ impl DefaultResizePolicy {
7676
// min_capacity(size) must be smaller than the internal capacity,
7777
// so that the map is not resized:
7878
// `min_capacity(usable_capacity(x)) <= x`.
79-
// The lef-hand side can only be smaller due to flooring by integer
79+
// The left-hand side can only be smaller due to flooring by integer
8080
// division.
8181
//
8282
// This doesn't have to be checked for overflow since allocation size
@@ -838,8 +838,8 @@ impl<K, V, S, H> HashMap<K, V, S>
838838
/// map.insert("b", 2);
839839
/// map.insert("c", 3);
840840
///
841-
/// for key in map.values() {
842-
/// println!("{}", key);
841+
/// for val in map.values() {
842+
/// println!("{}", val);
843843
/// }
844844
/// ```
845845
#[stable]
@@ -938,7 +938,7 @@ impl<K, V, S, H> HashMap<K, V, S>
938938
search_entry_hashed(&mut self.table, hash, key)
939939
}
940940

941-
/// Return the number of elements in the map.
941+
/// Returns the number of elements in the map.
942942
///
943943
/// # Example
944944
///
@@ -953,7 +953,7 @@ impl<K, V, S, H> HashMap<K, V, S>
953953
#[stable]
954954
pub fn len(&self) -> uint { self.table.size() }
955955

956-
/// Return true if the map contains no elements.
956+
/// Returns true if the map contains no elements.
957957
///
958958
/// # Example
959959
///
@@ -1274,7 +1274,7 @@ impl<K, V, S, H, Q: ?Sized> IndexMut<Q> for HashMap<K, V, S>
12741274
}
12751275
}
12761276

1277-
/// HashMap iterator
1277+
/// HashMap iterator.
12781278
#[stable]
12791279
pub struct Iter<'a, K: 'a, V: 'a> {
12801280
inner: table::Iter<'a, K, V>
@@ -1289,13 +1289,13 @@ impl<'a, K, V> Clone for Iter<'a, K, V> {
12891289
}
12901290
}
12911291

1292-
/// HashMap mutable values iterator
1292+
/// HashMap mutable values iterator.
12931293
#[stable]
12941294
pub struct IterMut<'a, K: 'a, V: 'a> {
12951295
inner: table::IterMut<'a, K, V>
12961296
}
12971297

1298-
/// HashMap move iterator
1298+
/// HashMap move iterator.
12991299
#[stable]
13001300
pub struct IntoIter<K, V> {
13011301
inner: iter::Map<
@@ -1306,7 +1306,7 @@ pub struct IntoIter<K, V> {
13061306
>
13071307
}
13081308

1309-
/// HashMap keys iterator
1309+
/// HashMap keys iterator.
13101310
#[stable]
13111311
pub struct Keys<'a, K: 'a, V: 'a> {
13121312
inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
@@ -1321,7 +1321,7 @@ impl<'a, K, V> Clone for Keys<'a, K, V> {
13211321
}
13221322
}
13231323

1324-
/// HashMap values iterator
1324+
/// HashMap values iterator.
13251325
#[stable]
13261326
pub struct Values<'a, K: 'a, V: 'a> {
13271327
inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
@@ -1336,7 +1336,7 @@ impl<'a, K, V> Clone for Values<'a, K, V> {
13361336
}
13371337
}
13381338

1339-
/// HashMap drain iterator
1339+
/// HashMap drain iterator.
13401340
#[unstable = "matches collection reform specification, waiting for dust to settle"]
13411341
pub struct Drain<'a, K: 'a, V: 'a> {
13421342
inner: iter::Map<
@@ -1347,35 +1347,35 @@ pub struct Drain<'a, K: 'a, V: 'a> {
13471347
>
13481348
}
13491349

1350-
/// A view into a single occupied location in a HashMap
1350+
/// A view into a single occupied location in a HashMap.
13511351
#[unstable = "precise API still being fleshed out"]
13521352
pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
13531353
elem: FullBucket<K, V, &'a mut RawTable<K, V>>,
13541354
}
13551355

1356-
/// A view into a single empty location in a HashMap
1356+
/// A view into a single empty location in a HashMap.
13571357
#[unstable = "precise API still being fleshed out"]
13581358
pub struct VacantEntry<'a, K: 'a, V: 'a> {
13591359
hash: SafeHash,
13601360
key: K,
13611361
elem: VacantEntryState<K, V, &'a mut RawTable<K, V>>,
13621362
}
13631363

1364-
/// A view into a single location in a map, which may be vacant or occupied
1364+
/// A view into a single location in a map, which may be vacant or occupied.
13651365
#[unstable = "precise API still being fleshed out"]
13661366
pub enum Entry<'a, K: 'a, V: 'a> {
1367-
/// An occupied Entry
1367+
/// An occupied Entry.
13681368
Occupied(OccupiedEntry<'a, K, V>),
1369-
/// A vacant Entry
1369+
/// A vacant Entry.
13701370
Vacant(VacantEntry<'a, K, V>),
13711371
}
13721372

1373-
/// Possible states of a VacantEntry
1373+
/// Possible states of a VacantEntry.
13741374
enum VacantEntryState<K, V, M> {
13751375
/// The index is occupied, but the key to insert has precedence,
1376-
/// and will kick the current one out on insertion
1376+
/// and will kick the current one out on insertion.
13771377
NeqElem(FullBucket<K, V, M>, uint),
1378-
/// The index is genuinely vacant
1378+
/// The index is genuinely vacant.
13791379
NoElem(EmptyBucket<K, V, M>),
13801380
}
13811381

@@ -1453,7 +1453,7 @@ impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
14531453

14541454
#[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
14551455
impl<'a, K, V> Entry<'a, K, V> {
1456-
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
1456+
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant.
14571457
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, K, V>> {
14581458
match self {
14591459
Occupied(entry) => Ok(entry.into_mut()),
@@ -1464,12 +1464,12 @@ impl<'a, K, V> Entry<'a, K, V> {
14641464

14651465
#[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
14661466
impl<'a, K, V> OccupiedEntry<'a, K, V> {
1467-
/// Gets a reference to the value in the entry
1467+
/// Gets a reference to the value in the entry.
14681468
pub fn get(&self) -> &V {
14691469
self.elem.read().1
14701470
}
14711471

1472-
/// Gets a mutable reference to the value in the entry
1472+
/// Gets a mutable reference to the value in the entry.
14731473
pub fn get_mut(&mut self) -> &mut V {
14741474
self.elem.read_mut().1
14751475
}

0 commit comments

Comments
 (0)