diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-09-25 22:34:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-09-25 22:34:47 +0200 |
| commit | 6a0f45b3f485279a04884e11fe2a37a205bdcea3 (patch) | |
| tree | 5771883f78bff905ce66890280786fc34585d640 /src/liballoc | |
| parent | 49e0049e9f2395983ca3cbc82c9665a750931de6 (diff) | |
| parent | 068c92b2cc0620d18eee1066cd3460f37c9ed9f3 (diff) | |
| download | rust-6a0f45b3f485279a04884e11fe2a37a205bdcea3.tar.gz rust-6a0f45b3f485279a04884e11fe2a37a205bdcea3.zip | |
Rollup merge of #54537 - sdroege:chunks-exact, r=alexcrichton
Rename slice::exact_chunks() to slice::chunks_exact() See https://github.com/rust-lang/rust/issues/47115#issuecomment-403090815 and https://github.com/rust-lang/rust/issues/47115#issuecomment-424053547
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/lib.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/slice.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/tests/lib.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/tests/slice.rs | 30 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 6ce24b65990..7960936dad6 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -116,7 +116,7 @@ #![feature(unsize)] #![feature(allocator_internals)] #![feature(on_unimplemented)] -#![feature(exact_chunks)] +#![feature(chunks_exact)] #![feature(rustc_const_unstable)] #![feature(const_vec_new)] #![feature(slice_partition_dedup)] diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index 6c0b1c33a1f..33d28bef2d7 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -123,8 +123,8 @@ pub use core::slice::{from_raw_parts, from_raw_parts_mut}; pub use core::slice::{from_ref, from_mut}; #[stable(feature = "slice_get_slice", since = "1.28.0")] pub use core::slice::SliceIndex; -#[unstable(feature = "exact_chunks", issue = "47115")] -pub use core::slice::{ExactChunks, ExactChunksMut}; +#[unstable(feature = "chunks_exact", issue = "47115")] +pub use core::slice::{ChunksExact, ChunksExactMut}; //////////////////////////////////////////////////////////////////////////////// // Basic slice extension methods diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index 710c659ac53..6ff39227555 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -20,7 +20,7 @@ #![feature(str_escape)] #![feature(try_reserve)] #![feature(unboxed_closures)] -#![feature(exact_chunks)] +#![feature(chunks_exact)] #![feature(repeat_generic_slice)] extern crate alloc_system; diff --git a/src/liballoc/tests/slice.rs b/src/liballoc/tests/slice.rs index f33bf64d40b..c214c59618d 100644 --- a/src/liballoc/tests/slice.rs +++ b/src/liballoc/tests/slice.rs @@ -975,27 +975,27 @@ fn test_chunksator_0() { } #[test] -fn test_exact_chunksator() { +fn test_chunks_exactator() { let v = &[1, 2, 3, 4, 5]; - assert_eq!(v.exact_chunks(2).len(), 2); + assert_eq!(v.chunks_exact(2).len(), 2); let chunks: &[&[_]] = &[&[1, 2], &[3, 4]]; - assert_eq!(v.exact_chunks(2).collect::<Vec<_>>(), chunks); + assert_eq!(v.chunks_exact(2).collect::<Vec<_>>(), chunks); let chunks: &[&[_]] = &[&[1, 2, 3]]; - assert_eq!(v.exact_chunks(3).collect::<Vec<_>>(), chunks); + assert_eq!(v.chunks_exact(3).collect::<Vec<_>>(), chunks); let chunks: &[&[_]] = &[]; - assert_eq!(v.exact_chunks(6).collect::<Vec<_>>(), chunks); + assert_eq!(v.chunks_exact(6).collect::<Vec<_>>(), chunks); let chunks: &[&[_]] = &[&[3, 4], &[1, 2]]; - assert_eq!(v.exact_chunks(2).rev().collect::<Vec<_>>(), chunks); + assert_eq!(v.chunks_exact(2).rev().collect::<Vec<_>>(), chunks); } #[test] #[should_panic] -fn test_exact_chunksator_0() { +fn test_chunks_exactator_0() { let v = &[1, 2, 3, 4]; - let _it = v.exact_chunks(0); + let _it = v.chunks_exact(0); } #[test] @@ -1235,10 +1235,10 @@ fn test_mut_chunks_0() { } #[test] -fn test_mut_exact_chunks() { +fn test_mut_chunks_exact() { let mut v = [0, 1, 2, 3, 4, 5, 6]; - assert_eq!(v.exact_chunks_mut(2).len(), 3); - for (i, chunk) in v.exact_chunks_mut(3).enumerate() { + assert_eq!(v.chunks_exact_mut(2).len(), 3); + for (i, chunk) in v.chunks_exact_mut(3).enumerate() { for x in chunk { *x = i as u8; } @@ -1248,9 +1248,9 @@ fn test_mut_exact_chunks() { } #[test] -fn test_mut_exact_chunks_rev() { +fn test_mut_chunks_exact_rev() { let mut v = [0, 1, 2, 3, 4, 5, 6]; - for (i, chunk) in v.exact_chunks_mut(3).rev().enumerate() { + for (i, chunk) in v.chunks_exact_mut(3).rev().enumerate() { for x in chunk { *x = i as u8; } @@ -1261,9 +1261,9 @@ fn test_mut_exact_chunks_rev() { #[test] #[should_panic] -fn test_mut_exact_chunks_0() { +fn test_mut_chunks_exact_0() { let mut v = [1, 2, 3, 4]; - let _it = v.exact_chunks_mut(0); + let _it = v.chunks_exact_mut(0); } #[test] |
