Use parentheses for cond! macro instead of preceding pipes
This is temporary. Once the macro parser has improved or been re-written these can be removed.
This commit is contained in:
parent
b9824e18c2
commit
7e4a176dd3
4 changed files with 14 additions and 14 deletions
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
fn clamp<T:Copy + Ord + Signed>(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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
fn clamp<T:Copy + Ord + Signed>(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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue