1
Fork 0
rust/tests/ui/newlambdas.rs

15 lines
286 B
Rust
Raw Normal View History

// run-pass
// Tests for the new |args| expr lambda syntax
fn f<F>(i: isize, f: F) -> isize where F: FnOnce(isize) -> isize { f(i) }
2015-01-02 17:32:54 -05:00
fn g<G>(_g: G) where G: FnOnce() { }
pub fn main() {
assert_eq!(f(10, |a| a), 10);
g(||());
assert_eq!(f(10, |a| a), 10);
g(||{});
}