let element_frequency : Vec<(&String, usize)> = duplicate_uniques.into_iter().map(|x| (&x, get_frequency(&uniques, x))).collect();
I used the variable x many times in code so it is showing the error as
let element_frequency : Vec<(&String, usize)> = duplicate_uniques.into_iter().map(|x| (&x, get_frequency(&uniques, x))).collect();
| - -----------------------------^--
| | || |
| | || move out of x
occurs here
| | |borrow of x
occurs here
| | returning this value requires that x
is borrowed for '1
| return type of closure is (&'1 std::string::String, usize)
Could you please help me to fix that error