Hi,
I'm learning Rust on a Sudoku solver. Following code works fine for me, but I don't like the verbosity of last assignment to negated_rows. I believe there must be a shorter way.
let all_numbers_set: HashSet<u8> = (1..=9).collect();
let mut rows: Vec<_> = (0..9).map(|_| HashSet::<u8>::new()).collect();
// rows get populated here upon Sudoku solution progress
let negated_rows: Vec<HashSet<u8>> = rows
.iter()
.map(|c| all_numbers_set
.difference(c)
.map(|x|*x)
.collect())
.collect();