Make option::is_some option::is_none pure

This commit is contained in:
Brian Anderson
2011-10-27 18:15:58 -07:00
parent 91997e79aa
commit b16d9019a8
+2 -2
View File
@@ -45,7 +45,7 @@ fn map<T, U>(f: block(T) -> U, opt: t<T>) -> t<U> {
Returns true if the option equals none
*/
fn is_none<T>(opt: t<T>) -> bool {
pure fn is_none<T>(opt: t<T>) -> bool {
alt opt { none. { true } some(_) { false } }
}
@@ -54,7 +54,7 @@ fn is_none<T>(opt: t<T>) -> bool {
Returns true if the option contains some value
*/
fn is_some<T>(opt: t<T>) -> bool { !is_none(opt) }
pure fn is_some<T>(opt: t<T>) -> bool { !is_none(opt) }
/*
Function: from_maybe