From f4e559ab40853220f16a4703727cec811b79d432 Mon Sep 17 00:00:00 2001
From: Maximilian Roos <m@maxroos.com>
Date: Wed, 26 Jun 2019 00:24:55 -0400
Subject: [PATCH] comments from @jturner314 review

---
 examples/life.rs         |  2 +-
 src/arraytraits.rs       | 13 ++++++++++---
 src/impl_constructors.rs |  8 +-------
 src/slice.rs             |  4 +++-
 4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/examples/life.rs b/examples/life.rs
index c48d4778a..9583f4283 100644
--- a/examples/life.rs
+++ b/examples/life.rs
@@ -1,9 +1,9 @@
 extern crate ndarray;
 
 use ndarray::prelude::*;
+use std::iter::FromIterator;
 
 const INPUT: &'static [u8] = include_bytes!("life.txt");
-use std::iter::FromIterator;
 
 const N: usize = 100;
 
diff --git a/src/arraytraits.rs b/src/arraytraits.rs
index 9ec3c0d18..44b7b4441 100644
--- a/src/arraytraits.rs
+++ b/src/arraytraits.rs
@@ -148,13 +148,20 @@ impl<A, S> FromIterator<A> for ArrayBase<S, Ix1>
 where
     S: DataOwned<Elem = A>,
 {
+    /// Create a one-dimensional array from a vector (no copying needed).
+    ///
+    /// **Panics** if the length is greater than `isize::MAX`.
+    ///
+    /// ```rust
+    /// use ndarray::Array;
+    ///
+    /// let array = Array::from(vec![1., 2., 3., 4.]);
+    /// ```
     fn from_iter<I>(iterable: I) -> ArrayBase<S, Ix1>
     where
         I: IntoIterator<Item = A>,
     {
-        // TODO: can I put this on one line?
-        let v: Vec<A> = iterable.into_iter().collect();
-        Self::from(v)
+        Self::from(iterable.into_iter().collect::<Vec<A>>())
     }
 }
 
diff --git a/src/impl_constructors.rs b/src/impl_constructors.rs
index 67a11ad7d..6475bf12b 100644
--- a/src/impl_constructors.rs
+++ b/src/impl_constructors.rs
@@ -44,13 +44,7 @@ where
     /// ```
     #[deprecated(note = "use standard `from`", since = "0.13.0")]
     pub fn from_vec(v: Vec<A>) -> Self {
-        if mem::size_of::<A>() == 0 {
-            assert!(
-                v.len() <= isize::MAX as usize,
-                "Length must fit in `isize`.",
-            );
-        }
-        unsafe { Self::from_shape_vec_unchecked(v.len() as Ix, v) }
+        Self::from(v)
     }
 
     // FIXME: Having this uncommented means that `from_iter` references this
diff --git a/src/slice.rs b/src/slice.rs
index ce0b0d049..491107a87 100644
--- a/src/slice.rs
+++ b/src/slice.rs
@@ -700,7 +700,9 @@ pub unsafe fn deref_raw_view_mut_into_view_mut_with_life<'a, A, D: Dimension>(
 /// use std::iter::FromIterator;
 ///
 /// # fn main() {
-/// let mut arr = Array1::from_iter(0..12);
+// TODO: the first line doesn't yet work: https://github.com/rust-ndarray/ndarray/pull/648#discussion_r297478854
+/// let arr: Array1<_> = (0..12).collect();
+/// // let mut arr = Array1::from_iter(0..12);
 /// let (a, b, c, d) = multislice!(arr, [0..5], mut [6..;2], [1..6], mut [7..;2]);
 /// assert_eq!(a, array![0, 1, 2, 3, 4]);
 /// assert_eq!(b, array![6, 8, 10]);