replace as usize casts with usize::from in slice sort

This commit is contained in:
Maybe Waffle 2022-09-04 20:54:51 +04:00
parent fff92d5238
commit 5a672921a3

View File

@ -365,12 +365,12 @@ where
if count > 0 {
macro_rules! left {
() => {
l.add(*start_l as usize)
l.add(usize::from(*start_l))
};
}
macro_rules! right {
() => {
r.sub((*start_r as usize) + 1)
r.sub(usize::from(*start_r) + 1)
};
}
@ -458,7 +458,7 @@ where
// the last block, so the `l.offset` calls are valid.
unsafe {
end_l = end_l.sub(1);
ptr::swap(l.add(*end_l as usize), r.sub(1));
ptr::swap(l.add(usize::from(*end_l)), r.sub(1));
r = r.sub(1);
}
}
@ -471,7 +471,7 @@ where
// SAFETY: See the reasoning in [remaining-elements-safety].
unsafe {
end_r = end_r.sub(1);
ptr::swap(l, r.sub((*end_r as usize) + 1));
ptr::swap(l, r.sub(usize::from(*end_r) + 1));
l = l.add(1);
}
}