For various reasons, I've been writing some sorting methods out, and slice.swap() allows me to avoid requiring "clone"
pub fn insert_sort<T: PartialOrd>(v: &mut [T]) {
//fewest swaps
for start in 0..v.len() {
let mut best = start;
for i in start..v.len() {
if v[i] < v[best] {
best = i;
}
}
v.swap(start, best);
}
}
But as far as I can tell, if that slice contained pinned data, it would swap it without blinking.
Is there something I'm missing that makes this OK?
I'm also aware that as a stable feature changing this would e tricky, but would it make sense to tweak for the next edition?