Skip to content

Commit

Permalink
Rollup merge of rust-lang#84248 - calebsander:refactor/vec-functions,…
Browse files Browse the repository at this point in the history
… 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 rust-lang#78461. I'm not sure what the rationale was for that change, but it seems preferable to maintain a single implementation.
  • Loading branch information
JohnTitor committed Apr 23, 2021
2 parents dcb4083 + f505d61 commit 5b7c986
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions library/alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit 5b7c986

Please sign in to comment.