Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Incorporated review feedback atop pcwalton's original patches.
(Original PR was #12716; feedback was provided by thestinger and me.)
  • Loading branch information
pnkfelix committed Mar 8, 2014
1 parent 15d9acc commit f978c77
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/libstd/vec_ng.rs
Expand Up @@ -14,10 +14,10 @@
use cast::{forget, transmute};
use clone::Clone;
use cmp::{Ord, Eq, Ordering, TotalEq, TotalOrd};
use container::Container;
use container::{Container, Mutable};
use default::Default;
use fmt;
use iter::{DoubleEndedIterator, FromIterator, Extendable, Iterator};
use iter::{DoubleEndedIterator, FromIterator, Extendable, Iterator, Rev};
use libc::{free, c_void};
use mem::{size_of, move_val_init};
use mem;
Expand Down Expand Up @@ -68,11 +68,7 @@ impl<T> Vec<T> {

impl<T: Clone> Vec<T> {
pub fn from_slice(values: &[T]) -> Vec<T> {
let mut vector = Vec::new();
for value in values.iter() {
vector.push((*value).clone())
}
vector
values.iter().map(|x| x.clone()).collect()
}

pub fn from_elem(length: uint, value: T) -> Vec<T> {
Expand Down Expand Up @@ -292,9 +288,8 @@ impl<T> Vec<T> {
}

#[inline]
pub fn move_rev_iter(mut self) -> MoveItems<T> {
self.reverse();
self.move_iter()
pub fn move_rev_iter(self) -> Rev<MoveItems<T>> {
self.move_iter().rev()
}

#[inline]
Expand Down Expand Up @@ -437,9 +432,12 @@ impl<T> Vec<T> {
pub fn as_ptr(&self) -> *T {
self.as_slice().as_ptr()
}
}

impl<T> Mutable for Vec<T> {
/// Clear the vector, removing all values.
#[inline]
pub fn clear(&mut self) {
fn clear(&mut self) {
self.truncate(0)
}
}
Expand Down

5 comments on commit f978c77

@bors
Copy link
Contributor

@bors bors commented on f978c77 Mar 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pnkfelix
at pnkfelix@f978c77

@bors
Copy link
Contributor

@bors bors commented on f978c77 Mar 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging pnkfelix/rust/fsk-devecing = f978c77 into auto

@bors
Copy link
Contributor

@bors bors commented on f978c77 Mar 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pnkfelix/rust/fsk-devecing = f978c77 merged ok, testing candidate = 0017056

@bors
Copy link
Contributor

@bors bors commented on f978c77 Mar 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on f978c77 Mar 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 0017056

Please sign in to comment.