2 #![allow(unused_braces)]
4 fn test_generic<T: Clone, F>(expected: T, eq: F) where F: FnOnce(T, T) -> bool {
5 let actual: T = { expected.clone() };
6 assert!(eq(expected, actual));
10 fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; }
11 test_generic::<bool, _>(true, compare_bool);
21 fn compare_rec(t1: Pair, t2: Pair) -> bool {
22 t1.a == t2.a && t1.b == t2.b
24 test_generic::<Pair, _>(Pair {a: 1, b: 2}, compare_rec);
27 pub fn main() { test_bool(); test_rec(); }