diff options
| author | bors <bors@rust-lang.org> | 2013-09-19 00:31:05 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-09-19 00:31:05 -0700 |
| commit | a7cf7b7b0b3392bc3219e2bea44a0a18283aae50 (patch) | |
| tree | 8967276fc1f070a5537e713320a2b4401312de9c /src/libsyntax | |
| parent | 3c0013134cecbe9592f02ed5c6a94c06effb19d4 (diff) | |
| parent | 47576313695170013cfe07d57e81c2e879a14c14 (diff) | |
| download | rust-a7cf7b7b0b3392bc3219e2bea44a0a18283aae50.tar.gz rust-a7cf7b7b0b3392bc3219e2bea44a0a18283aae50.zip | |
auto merge of #9291 : jzelinskie/rust/remove-cond, r=alexcrichton
This is my first contribution, so please point out anything that I may have missed.
I consulted IRC and settled on `match () { ... }` for most of the replacements.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 7254e8e775a..0bee7895420 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -894,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) => ( |
