Did you find it necessary to have this case? I think that `swap` handles the case where the two indices are the same.