about summary refs log tree commit diff
path: root/src/libsyntax/ext/expand.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libsyntax/ext/expand.rs')
-rw-r--r--src/libsyntax/ext/expand.rs46
1 files changed, 2 insertions, 44 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index ac094c27a81..0bee7895420 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -863,9 +863,7 @@ pub fn std_macros() -> @str {
 
                 use super::*;
 
-                static key: ::std::local_data::Key<
-                    @::std::condition::Handler<$input, $out>> =
-                    &::std::local_data::Key;
+                local_data_key!(key: @::std::condition::Handler<$input, $out>)
 
                 pub static cond :
                     ::std::condition::Condition<$input,$out> =
@@ -884,9 +882,7 @@ pub fn std_macros() -> @str {
 
                 use super::*;
 
-                static key: ::std::local_data::Key<
-                    @::std::condition::Handler<$input, $out>> =
-                    &::std::local_data::Key;
+                local_data_key!(key: @::std::condition::Handler<$input, $out>)
 
                 pub static cond :
                     ::std::condition::Condition<$input,$out> =
@@ -898,42 +894,6 @@ pub fn std_macros() -> @str {
         }
     )
 
-    //
-    // A scheme-style conditional that helps to improve code clarity in some instances when
-    // the `if`, `else if`, and `else` keywords obscure predicates undesirably.
-    //
-    // # Example
-    //
-    // ~~~
-    // let clamped =
-    //     if x > mx { mx }
-    //     else if x < mn { mn }
-    //     else { x };
-    // ~~~
-    //
-    // Using `cond!`, the above could be written as:
-    //
-    // ~~~
-    // let clamped = cond!(
-    //     (x > mx) { mx }
-    //     (x < mn) { mn }
-    //     _        { x  }
-    // );
-    // ~~~
-    //
-    // The optional default case is denoted by `_`.
-    //
-    macro_rules! cond (
-        ( $(($pred:expr) $body:block)+ _ $default:block ) => (
-            $(if $pred $body else)+
-            $default
-        );
-        // for if the default case was ommitted
-        ( $(($pred:expr) $body:block)+ ) => (
-            $(if $pred $body)else+
-        );
-    )
-
     // NOTE(acrichto): start removing this after the next snapshot
     macro_rules! printf (
         ($arg:expr) => (
@@ -975,8 +935,6 @@ pub fn std_macros() -> @str {
         ($($arg:tt)*) => (::std::io::println(format!($($arg)*)))
     )
 
-    // NOTE: use this after a snapshot lands to abstract the details
-    // of the TLS interface.
     macro_rules! local_data_key (
         ($name:ident: $ty:ty) => (
             static $name: ::std::local_data::Key<$ty> = &::std::local_data::Key;