diff --git a/src/libstd/fun_treemap.rs b/src/libstd/fun_treemap.rs index 30edd535a88..6b051fa21b1 100644 --- a/src/libstd/fun_treemap.rs +++ b/src/libstd/fun_treemap.rs @@ -37,8 +37,8 @@ pub fn insert(m: Treemap, k: K, v: V) -> Treemap @match m { @Empty => Node(@k, @v, @Empty, @Empty), @Node(@copy kk, vv, left, right) => cond!( - | k < kk { Node(@kk, vv, insert(left, k, v), right) } - | k == kk { Node(@kk, @v, left, right) } + (k < kk) { Node(@kk, vv, insert(left, k, v), right) } + (k == kk) { Node(@kk, @v, left, right) } _ { Node(@kk, vv, left, insert(right, k, v)) } ) } @@ -49,8 +49,8 @@ pub fn find(m: Treemap, k: K) -> Option { match *m { Empty => None, Node(@ref kk, @copy v, left, right) => cond!( - | k == *kk { Some(v) } - | k < *kk { find(left, k) } + (k == *kk) { Some(v) } + (k < *kk) { find(left, k) } _ { find(right, k) } ) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index ad1da0a8685..f9ca84473fb 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -559,8 +559,8 @@ pub fn core_macros() -> ~str { // // ~~~ // let clamped = cond!( - // | x > mx { mx } - // | x < mn { mn } + // (x > mx) { mx } + // (x < mn) { mn } // _ { x } // ); // ~~~ @@ -568,12 +568,12 @@ pub fn core_macros() -> ~str { // The optional default case is denoted by `_`. // macro_rules! cond ( - ($( | $pred:expr $body:block)+ _ $default:block ) => ( + ( $(($pred:expr) $body:block)+ _ $default:block ) => ( $(if $pred $body else)+ $default ); // for if the default case was ommitted - ( $( | $pred:expr $body:block )+ ) => ( + ( $(($pred:expr) $body:block)+ ) => ( $(if $pred $body)else+ ); ) diff --git a/src/test/run-pass/cond-macro-no-default.rs b/src/test/run-pass/cond-macro-no-default.rs index b8280c30e08..6b90308f8a8 100644 --- a/src/test/run-pass/cond-macro-no-default.rs +++ b/src/test/run-pass/cond-macro-no-default.rs @@ -10,8 +10,8 @@ fn clamp(x: T, mn: T, mx: T) -> T { cond!( - | x > mx { return mx; } - | x < mn { return mn; } + (x > mx) { return mx; } + (x < mn) { return mn; } ) return x; } @@ -20,4 +20,4 @@ fn main() { assert_eq!(clamp(1, 2, 4), 2); assert_eq!(clamp(8, 2, 4), 4); assert_eq!(clamp(3, 2, 4), 3); -} \ No newline at end of file +} diff --git a/src/test/run-pass/cond-macro.rs b/src/test/run-pass/cond-macro.rs index ebe1cbbfd82..929752b3f1a 100644 --- a/src/test/run-pass/cond-macro.rs +++ b/src/test/run-pass/cond-macro.rs @@ -10,8 +10,8 @@ fn clamp(x: T, mn: T, mx: T) -> T { cond!( - | x > mx { mx } - | x < mn { mn } + (x > mx) { mx } + (x < mn) { mn } _ { x } ) } @@ -20,4 +20,4 @@ fn main() { assert_eq!(clamp(1, 2, 4), 2); assert_eq!(clamp(8, 2, 4), 4); assert_eq!(clamp(3, 2, 4), 3); -} \ No newline at end of file +}