Skip to content

Commit 4a73c8e

Browse files
committed
std: add default implementations to Option
1 parent 653400a commit 4a73c8e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libstd/option.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ let unwrapped_msg = match msg {
4343

4444
use clone::Clone;
4545
use cmp::{Eq,Ord};
46+
use default::Default;
4647
use util;
4748
use num::Zero;
4849
use iter;
@@ -349,6 +350,10 @@ impl<T> Option<T> {
349350
}
350351
}
351352

353+
impl<T> Default for Option<T> {
354+
fn default() -> Option<T> { None }
355+
}
356+
352357
impl<T:Zero> Option<T> {
353358
/// Returns the contained value or zero (for this type)
354359
#[inline]

0 commit comments

Comments
 (0)