@@ -149,7 +149,7 @@ impl<T> Option<T> {
149
149
}
150
150
}
151
151
152
- /// Returns the contained value or a default
152
+ /// Returns the contained value or a default.
153
153
#[ inline]
154
154
pub fn unwrap_or ( self , def : T ) -> T {
155
155
match self {
@@ -158,7 +158,7 @@ impl<T> Option<T> {
158
158
}
159
159
}
160
160
161
- /// Returns the contained value or computes it from a closure
161
+ /// Returns the contained value or computes it from a closure.
162
162
#[ inline]
163
163
pub fn unwrap_or_else ( self , f: || -> T ) -> T {
164
164
match self {
@@ -183,7 +183,7 @@ impl<T> Option<T> {
183
183
match self { None => def, Some ( t) => f ( t) }
184
184
}
185
185
186
- /// Apply a function to the contained value or do nothing.
186
+ /// Applies a function to the contained value or does nothing.
187
187
/// Returns true if the contained value was mutated.
188
188
pub fn mutate ( & mut self , f: |T | -> T ) -> bool {
189
189
if self . is_some ( ) {
@@ -192,7 +192,7 @@ impl<T> Option<T> {
192
192
} else { false }
193
193
}
194
194
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.
196
196
/// Returns true if the contained value was mutated, or false if set to the default.
197
197
pub fn mutate_or_set ( & mut self , def : T , f: |T | -> T ) -> bool {
198
198
if self . is_some ( ) {
@@ -208,19 +208,19 @@ impl<T> Option<T> {
208
208
// Iterator constructors
209
209
/////////////////////////////////////////////////////////////////////////
210
210
211
- /// Return an iterator over the possibly contained value
211
+ /// Returns an iterator over the possibly contained value.
212
212
#[ inline]
213
213
pub fn iter < ' r > ( & ' r self ) -> Item < & ' r T > {
214
214
Item { opt : self . as_ref ( ) }
215
215
}
216
216
217
- /// Return a mutable iterator over the possibly contained value
217
+ /// Returns a mutable iterator over the possibly contained value.
218
218
#[ inline]
219
219
pub fn mut_iter < ' r > ( & ' r mut self ) -> Item < & ' r mut T > {
220
220
Item { opt : self . as_mut ( ) }
221
221
}
222
222
223
- /// Return a consuming iterator over the possibly contained value
223
+ /// Returns a consuming iterator over the possibly contained value.
224
224
#[ inline]
225
225
pub fn move_iter ( self ) -> Item < T > {
226
226
Item { opt : self }
@@ -264,15 +264,15 @@ impl<T> Option<T> {
264
264
pub fn or_else ( self , f: || -> Option < T > ) -> Option < T > {
265
265
match self {
266
266
Some ( _) => self ,
267
- None => f( ) ,
267
+ None => f( )
268
268
}
269
269
}
270
270
271
271
/////////////////////////////////////////////////////////////////////////
272
272
// Misc
273
273
/////////////////////////////////////////////////////////////////////////
274
274
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.
276
276
#[ inline]
277
277
pub fn take ( & mut self ) -> Option < T > {
278
278
mem:: replace ( self , None )
@@ -282,7 +282,7 @@ impl<T> Option<T> {
282
282
#[ inline( always) ]
283
283
pub fn filtered ( self , f: |t: & T | -> bool ) -> Option < T > {
284
284
match self {
285
- Some ( x) => if f ( & x) { Some ( x) } else { None } ,
285
+ Some ( x) => if f( & x) { Some ( x) } else { None } ,
286
286
None => None
287
287
}
288
288
}
0 commit comments