3 ms·
Could someone explain why there is no dereference in let double = |n: &i32| -> i32 { n * 2 };
by jFriedensreich 6y ago
Could someone explain why there is no dereference in
let double = |n: &i32| -> i32 { n * 2 };
- rkwz 6y agoThis SO answer explains the reasoning - https://stackoverflow.com/questions/54100030/why-do-i-need-to-dereference-a-variable-when-comparing-it-but-not-when-doing-ari https://stackoverflow.com/questions/54100030/why-do-i-need-t... :) Edit: On hindsight, I should've picked a simpler example that doesn't deal with references.