Skip to content

Commit

Permalink
replace as usize casts with usize::from in slice sort
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Sep 4, 2022
1 parent fff92d5 commit 5a67292
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/core/src/slice/sort.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
}

Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand Down

0 comments on commit 5a67292

Please sign in to comment.