From e3a066bde87255ce83fc83a27c452f088993466c Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Fri, 9 Dec 2011 10:22:16 -0800 Subject: [PATCH] Swap arg order for option::{may,maybe} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This lets us write the block syntax sugar: option::may(x) { |y| … } --- src/libstd/option.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/option.rs b/src/libstd/option.rs index 403cb47f47e64..9ab74496d0b0f 100644 --- a/src/libstd/option.rs +++ b/src/libstd/option.rs @@ -70,7 +70,7 @@ Function: maybe Applies a function to the contained value or returns a default */ -fn maybe(def: U, f: block(T) -> U, opt: t) -> U { +fn maybe(def: U, opt: t, f: block(T) -> U) -> U { alt opt { none. { def } some(t) { f(t) } } } @@ -80,7 +80,7 @@ Function: may Performs an operation on the contained value or does nothing */ -fn may(f: block(T), opt: t) { +fn may(opt: t, f: block(T)) { alt opt { none. {/* nothing */ } some(t) { f(t); } } }