Skip to content

Commit a198d54

Browse files
committed
Documentation and formatting changes for option.rs.
1 parent ffe72e9 commit a198d54

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/libstd/option.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ impl<T> Option<T> {
149149
}
150150
}
151151

152-
/// Returns the contained value or a default
152+
/// Returns the contained value or a default.
153153
#[inline]
154154
pub fn unwrap_or(self, def: T) -> T {
155155
match self {
@@ -158,7 +158,7 @@ impl<T> Option<T> {
158158
}
159159
}
160160

161-
/// Returns the contained value or computes it from a closure
161+
/// Returns the contained value or computes it from a closure.
162162
#[inline]
163163
pub fn unwrap_or_else(self, f: || -> T) -> T {
164164
match self {
@@ -183,7 +183,7 @@ impl<T> Option<T> {
183183
match self { None => def, Some(t) => f(t) }
184184
}
185185

186-
/// Apply a function to the contained value or do nothing.
186+
/// Applies a function to the contained value or does nothing.
187187
/// Returns true if the contained value was mutated.
188188
pub fn mutate(&mut self, f: |T| -> T) -> bool {
189189
if self.is_some() {
@@ -192,7 +192,7 @@ impl<T> Option<T> {
192192
} else { false }
193193
}
194194

195-
/// Apply a function to the contained value or set it to a default.
195+
/// Applies a function to the contained value or sets it to a default.
196196
/// Returns true if the contained value was mutated, or false if set to the default.
197197
pub fn mutate_or_set(&mut self, def: T, f: |T| -> T) -> bool {
198198
if self.is_some() {
@@ -208,19 +208,19 @@ impl<T> Option<T> {
208208
// Iterator constructors
209209
/////////////////////////////////////////////////////////////////////////
210210

211-
/// Return an iterator over the possibly contained value
211+
/// Returns an iterator over the possibly contained value.
212212
#[inline]
213213
pub fn iter<'r>(&'r self) -> Item<&'r T> {
214214
Item{opt: self.as_ref()}
215215
}
216216

217-
/// Return a mutable iterator over the possibly contained value
217+
/// Returns a mutable iterator over the possibly contained value.
218218
#[inline]
219219
pub fn mut_iter<'r>(&'r mut self) -> Item<&'r mut T> {
220220
Item{opt: self.as_mut()}
221221
}
222222

223-
/// Return a consuming iterator over the possibly contained value
223+
/// Returns a consuming iterator over the possibly contained value.
224224
#[inline]
225225
pub fn move_iter(self) -> Item<T> {
226226
Item{opt: self}
@@ -264,15 +264,15 @@ impl<T> Option<T> {
264264
pub fn or_else(self, f: || -> Option<T>) -> Option<T> {
265265
match self {
266266
Some(_) => self,
267-
None => f(),
267+
None => f()
268268
}
269269
}
270270

271271
/////////////////////////////////////////////////////////////////////////
272272
// Misc
273273
/////////////////////////////////////////////////////////////////////////
274274

275-
/// Take the value out of the option, leaving a `None` in its place.
275+
/// Takes the value out of the option, leaving a `None` in its place.
276276
#[inline]
277277
pub fn take(&mut self) -> Option<T> {
278278
mem::replace(self, None)
@@ -282,7 +282,7 @@ impl<T> Option<T> {
282282
#[inline(always)]
283283
pub fn filtered(self, f: |t: &T| -> bool) -> Option<T> {
284284
match self {
285-
Some(x) => if f(&x) {Some(x)} else {None},
285+
Some(x) => if f(&x) { Some(x) } else { None },
286286
None => None
287287
}
288288
}

0 commit comments

Comments
 (0)