Smarter impl of Dedup that doesn't need Clone