Why is “&&” being used in closure arguments?
I have two questions regarding this example : let a = [1, 2, 3]; assert_eq!(a.iter().find(|&&x| x == 2), Some(&2)); assert_eq!(a.iter().find(|&&x| x == 5), None); Why is &&x used in the closure arguments rather than just x ? I understand that & is passing a reference to an object, but what does using it twice mean? I don't understand what the documentation says: Because find() takes a reference, and many iterators iterate over references, this leads to a possibly confusing situation where the argument is a double reference. You can see this effect in the examples below, with &&x . Why is Some(