Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slice::rotate_left is stable now #115

Merged
merged 1 commit into from
Jun 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 0 additions & 16 deletions src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2616,11 +2616,7 @@ fn read2_abbreviated(mut child: Child) -> io::Result<Output> {
*skipped += data.len();
if data.len() <= TAIL_LEN {
tail[..data.len()].copy_from_slice(data);
#[cfg(not(feature = "stable"))]
tail.rotate_left(data.len());
// FIXME: Remove this when rotate_left is stable in 1.26
#[cfg(feature = "stable")]
rotate_left(tail, data.len());
} else {
tail.copy_from_slice(&data[(data.len() - TAIL_LEN)..]);
}
Expand Down Expand Up @@ -2658,15 +2654,3 @@ fn read2_abbreviated(mut child: Child) -> io::Result<Output> {
stderr: stderr.into_bytes(),
})
}

// FIXME: Remove this when rotate_left is stable in 1.26
#[cfg(feature = "stable")]
fn rotate_left<T>(slice: &mut [T], places: usize) {
// Rotation can be implemented by reversing the slice,
// splitting the slice in two, and then reversing the
// two sub-slices.
slice.reverse();
let (a, b) = slice.split_at_mut(places);
a.reverse();
b.reverse();
}