The Rust Closure Pitfall That Silently Corrupted Our Metrics: A Debugging Saga
medium.com
medium.com
Fun fact is, the behavior used to be what the author expected: |thing| thing.field would capture the entire thing, not just the field.
This also used to be really annoying, so they changed it.
The 2021 Rust edition introduced partial capturing [1]. This greatly increased ergonomics, but it seems it has a hidden cost too. Unfortunate.
[1] https://doc.rust-lang.org/edition-guide/rust-2021/disjoint-c...