Type mismatches resolving a closure that takes arguments by reference
The short version is that there’s a difference between the lifetimes that are inferred if the closure is written inline or stored as a variable. Write the closure inline and remove all the extraneous types: fn test(points: &[Point]) -> (&Point, f32) { let init = points.first().expect(“No initial”); fold(&points, (init, 0.), |(q, max_d), p| { let … Read more