diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2021-04-24 03:44:04 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-24 03:44:04 +0900 |
| commit | 5b7c98676f66122705da47f2ef68bbd47e9a9460 (patch) | |
| tree | dab82d6642fa12ad27a5c290fabfb08a24f9f523 | |
| parent | dcb4083ed94d0c14be8f731fca54b4c94fab6b64 (diff) | |
| parent | f505d619c4334a34a83fc7918acbf8bad389850f (diff) | |
| download | rust-5b7c98676f66122705da47f2ef68bbd47e9a9460.tar.gz rust-5b7c98676f66122705da47f2ef68bbd47e9a9460.zip | |
Rollup merge of #84248 - calebsander:refactor/vec-functions, r=Amanieu
Remove duplicated fn(Box<[T]>) -> Vec<T> `<[T]>::into_vec()` does the same thing as `Vec::from::<Box<[T]>>()`, so they can be implemented in terms of each other. This was the previous implementation of `Vec::from()`, but was changed in #78461. I'm not sure what the rationale was for that change, but it seems preferable to maintain a single implementation.
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 1b78356fde5..e459442dfcf 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2810,8 +2810,7 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> { /// assert_eq!(Vec::from(b), vec![1, 2, 3]); /// ``` fn from(s: Box<[T], A>) -> Self { - let len = s.len(); - Self { buf: RawVec::from_box(s), len } + s.into_vec() } } |
