Skip to content

Commit 46b7644

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#78461. I'm not sure what the rationale was for that change, but it seems preferable to maintain a single implementation.
2 parents 4413950 + f505d61 commit 46b7644

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

library/alloc/src/vec/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2810,8 +2810,7 @@ impl<T, A: Allocator> From<Box<[T], A>> for Vec<T, A> {
28102810
/// assert_eq!(Vec::from(b), vec![1, 2, 3]);
28112811
/// ```
28122812
fn from(s: Box<[T], A>) -> Self {
2813-
let len = s.len();
2814-
Self { buf: RawVec::from_box(s), len }
2813+
s.into_vec()
28152814
}
28162815
}
28172816

0 commit comments

Comments
 (0)