@@ -1603,50 +1603,6 @@ impl<T: Clone> Vec<T> {
16031603 }
16041604}
16051605
1606- impl < T : Default > Vec < T > {
1607- /// Resizes the `Vec` in-place so that `len` is equal to `new_len`.
1608- ///
1609- /// If `new_len` is greater than `len`, the `Vec` is extended by the
1610- /// difference, with each additional slot filled with [`Default::default()`].
1611- /// If `new_len` is less than `len`, the `Vec` is simply truncated.
1612- ///
1613- /// This method uses [`Default`] to create new values on every push. If
1614- /// you'd rather [`Clone`] a given value, use [`resize`].
1615- ///
1616- /// # Examples
1617- ///
1618- /// ```
1619- /// # #![allow(deprecated)]
1620- /// #![feature(vec_resize_default)]
1621- ///
1622- /// let mut vec = vec![1, 2, 3];
1623- /// vec.resize_default(5);
1624- /// assert_eq!(vec, [1, 2, 3, 0, 0]);
1625- ///
1626- /// let mut vec = vec![1, 2, 3, 4];
1627- /// vec.resize_default(2);
1628- /// assert_eq!(vec, [1, 2]);
1629- /// ```
1630- ///
1631- /// [`resize`]: Vec::resize
1632- #[ unstable( feature = "vec_resize_default" , issue = "41758" ) ]
1633- #[ rustc_deprecated(
1634- reason = "This is moving towards being removed in favor \
1635- of `.resize_with(Default::default)`. If you disagree, please comment \
1636- in the tracking issue.",
1637- since = "1.33.0"
1638- ) ]
1639- pub fn resize_default ( & mut self , new_len : usize ) {
1640- let len = self . len ( ) ;
1641-
1642- if new_len > len {
1643- self . extend_with ( new_len - len, ExtendDefault ) ;
1644- } else {
1645- self . truncate ( new_len) ;
1646- }
1647- }
1648- }
1649-
16501606// This code generalizes `extend_with_{element,default}`.
16511607trait ExtendWith < T > {
16521608 fn next ( & mut self ) -> T ;
0 commit comments