1 2 3 4 5 6 7 8 9 10 11 12 13
use borrowscope_macro::trace_borrow; #[trace_borrow] fn test_closure_with_method() { let s = String::from("hello"); let closure = || s.len(); let result = closure(); assert_eq!(result, 5); } fn main() { test_closure_with_method(); }