diff --git a/src/libstd/option.rs b/src/libstd/option.rs index e4d843d88824d..9327136c771f0 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -149,7 +149,7 @@ impl Option { } } - /// Returns the contained value or a default + /// Returns the contained value or a default. #[inline] pub fn unwrap_or(self, def: T) -> T { match self { @@ -158,7 +158,7 @@ impl Option { } } - /// Returns the contained value or computes it from a closure + /// Returns the contained value or computes it from a closure. #[inline] pub fn unwrap_or_else(self, f: || -> T) -> T { match self { @@ -183,7 +183,7 @@ impl Option { match self { None => def, Some(t) => f(t) } } - /// Apply a function to the contained value or do nothing. + /// Applies a function to the contained value or does nothing. /// Returns true if the contained value was mutated. pub fn mutate(&mut self, f: |T| -> T) -> bool { if self.is_some() { @@ -192,7 +192,7 @@ impl Option { } else { false } } - /// Apply a function to the contained value or set it to a default. + /// Applies a function to the contained value or sets it to a default. /// Returns true if the contained value was mutated, or false if set to the default. pub fn mutate_or_set(&mut self, def: T, f: |T| -> T) -> bool { if self.is_some() { @@ -208,19 +208,19 @@ impl Option { // Iterator constructors ///////////////////////////////////////////////////////////////////////// - /// Return an iterator over the possibly contained value + /// Returns an iterator over the possibly contained value. #[inline] pub fn iter<'r>(&'r self) -> Item<&'r T> { Item{opt: self.as_ref()} } - /// Return a mutable iterator over the possibly contained value + /// Returns a mutable iterator over the possibly contained value. #[inline] pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> { Item{opt: self.as_mut()} } - /// Return a consuming iterator over the possibly contained value + /// Returns a consuming iterator over the possibly contained value. #[inline] pub fn move_iter(self) -> Item { Item{opt: self} @@ -264,7 +264,7 @@ impl Option { pub fn or_else(self, f: || -> Option) -> Option { match self { Some(_) => self, - None => f(), + None => f() } } @@ -272,7 +272,7 @@ impl Option { // Misc ///////////////////////////////////////////////////////////////////////// - /// Take the value out of the option, leaving a `None` in its place. + /// Takes the value out of the option, leaving a `None` in its place. #[inline] pub fn take(&mut self) -> Option { mem::replace(self, None) @@ -282,7 +282,7 @@ impl Option { #[inline(always)] pub fn filtered(self, f: |t: &T| -> bool) -> Option { match self { - Some(x) => if f(&x) {Some(x)} else {None}, + Some(x) => if f(&x) { Some(x) } else { None }, None => None } }