Skip to content

Commit 5991c60

Browse files
author
blake2-ppc
committed
option: Title-case Some and None in docs and fail messages
For accuracy, say 'get_ref None' instead of 'get_ref none', and so on.
1 parent e3142c5 commit 5991c60

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/libstd/option.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ impl<T> Option<T> {
119119
}
120120
}
121121

122-
/// Returns true if the option equals `none`
122+
/// Returns true if the option equals `None`
123123
#[inline]
124124
pub fn is_none(&self) -> bool {
125125
match *self { None => true, Some(_) => false }
126126
}
127127

128-
/// Returns true if the option contains some value
128+
/// Returns true if the option contains a `Some` value
129129
#[inline]
130130
pub fn is_some(&self) -> bool { !self.is_none() }
131131

@@ -168,19 +168,19 @@ impl<T> Option<T> {
168168
}
169169
}
170170

171-
/// Maps a `some` value from one type to another by reference
171+
/// Maps a `Some` value from one type to another by reference
172172
#[inline]
173173
pub fn map<'a, U>(&'a self, f: &fn(&'a T) -> U) -> Option<U> {
174174
match *self { Some(ref x) => Some(f(x)), None => None }
175175
}
176176

177-
/// Maps a `some` value from one type to another by a mutable reference
177+
/// Maps a `Some` value from one type to another by a mutable reference
178178
#[inline]
179179
pub fn map_mut<'a, U>(&'a mut self, f: &fn(&'a mut T) -> U) -> Option<U> {
180180
match *self { Some(ref mut x) => Some(f(x)), None => None }
181181
}
182182

183-
/// Maps a `some` value from one type to another by a mutable reference,
183+
/// Maps a `Some` value from one type to another by a mutable reference,
184184
/// or returns a default value.
185185
#[inline]
186186
pub fn map_mut_default<'a, U>(&'a mut self, def: U, f: &fn(&'a mut T) -> U) -> U {
@@ -261,7 +261,7 @@ impl<T> Option<T> {
261261
pub fn get_ref<'a>(&'a self) -> &'a T {
262262
match *self {
263263
Some(ref x) => x,
264-
None => fail!("option::get_ref none")
264+
None => fail!("option::get_ref None")
265265
}
266266
}
267267

@@ -283,7 +283,7 @@ impl<T> Option<T> {
283283
pub fn get_mut_ref<'a>(&'a mut self) -> &'a mut T {
284284
match *self {
285285
Some(ref mut x) => x,
286-
None => fail!("option::get_mut_ref none")
286+
None => fail!("option::get_mut_ref None")
287287
}
288288
}
289289

@@ -307,7 +307,7 @@ impl<T> Option<T> {
307307
*/
308308
match self {
309309
Some(x) => x,
310-
None => fail!("option::unwrap none")
310+
None => fail!("option::unwrap None")
311311
}
312312
}
313313

@@ -321,7 +321,7 @@ impl<T> Option<T> {
321321
*/
322322
#[inline]
323323
pub fn take_unwrap(&mut self) -> T {
324-
if self.is_none() { fail!("option::take_unwrap none") }
324+
if self.is_none() { fail!("option::take_unwrap None") }
325325
self.take().unwrap()
326326
}
327327

@@ -331,7 +331,7 @@ impl<T> Option<T> {
331331
*
332332
* # Failure
333333
*
334-
* Fails if the value equals `none`
334+
* Fails if the value equals `None`
335335
*/
336336
#[inline]
337337
pub fn expect(self, reason: &str) -> T {
@@ -359,7 +359,7 @@ impl<T> Option<T> {
359359
pub fn get(self) -> T {
360360
match self {
361361
Some(x) => return x,
362-
None => fail!("option::get none")
362+
None => fail!("option::get None")
363363
}
364364
}
365365

@@ -369,7 +369,7 @@ impl<T> Option<T> {
369369
match self { Some(x) => x, None => def }
370370
}
371371

372-
/// Applies a function zero or more times until the result is none.
372+
/// Applies a function zero or more times until the result is None.
373373
#[inline]
374374
pub fn while_some(self, blk: &fn(v: T) -> Option<T>) {
375375
let mut opt = self;

0 commit comments

Comments
 (0)