Skip to content

Commit b02588a

Browse files
committed
Update Default to not use Clone
1 parent bf4b59a commit b02588a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,12 @@ impl<A, D> Array<A, D> where D: Dimension
184184

185185
/// Construct an Array with default values, dimension `dim`.
186186
pub fn default(dim: D) -> Array<A, D>
187-
where A: Clone + Default
187+
where A: Default
188188
{
189-
Array::from_elem(dim, A::default())
189+
let v = (0..dim.size()).map(|_| A::default()).collect();
190+
unsafe {
191+
Array::from_vec_dim(dim, v)
192+
}
190193
}
191194

192195
/// Construct an Array with copies of **elem**.

0 commit comments

Comments
 (0)