]> git.lizzy.rs Git - rust.git/commitdiff
Make option::is_some option::is_none pure
authorBrian Anderson <banderson@mozilla.com>
Fri, 28 Oct 2011 01:15:58 +0000 (18:15 -0700)
committerBrian Anderson <banderson@mozilla.com>
Fri, 28 Oct 2011 01:15:58 +0000 (18:15 -0700)
src/lib/option.rs

index 970349c7d31a3a6798a2f82e749032233a9f7206..5121e3f7d08e0b97c4affc60c582f22c38ad84aa 100644 (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