2019-07-27 00:54:25 +03:00
|
|
|
//@ run-pass
|
2012-06-29 18:09:56 -07:00
|
|
|
// Tests for the new |args| expr lambda syntax
|
|
|
|
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn f<F>(i: isize, f: F) -> isize where F: FnOnce(isize) -> isize { f(i) }
|
2012-06-29 18:09:56 -07:00
|
|
|
|
2015-01-02 17:32:54 -05:00
|
|
|
fn g<G>(_g: G) where G: FnOnce() { }
|
2012-06-29 18:09:56 -07:00
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() {
|
2013-05-18 22:02:45 -04:00
|
|
|
assert_eq!(f(10, |a| a), 10);
|
2012-06-29 18:09:56 -07:00
|
|
|
g(||());
|
2013-11-21 17:23:21 -08:00
|
|
|
assert_eq!(f(10, |a| a), 10);
|
|
|
|
g(||{});
|
2012-06-29 18:09:56 -07:00
|
|
|
}
|