diff --git a/.travis.yml b/.travis.yml index b6e89102d..4c484d0c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ sudo: required dist: trusty matrix: include: - - rust: 1.27.0 + - rust: 1.30.0 env: - FEATURES='test docs' - rust: stable diff --git a/benches/bench1.rs b/benches/bench1.rs index ce239cd3e..13bbcb29a 100644 --- a/benches/bench1.rs +++ b/benches/bench1.rs @@ -2,7 +2,6 @@ #![allow(unused_imports)] extern crate test; -#[macro_use(s, azip)] extern crate ndarray; use ndarray::{ @@ -13,7 +12,7 @@ use ndarray::{ Array2, Zip, }; -use ndarray::{arr0, arr1, arr2}; +use ndarray::{arr0, arr1, arr2, azip, s}; use ndarray::ShapeBuilder; use test::black_box; diff --git a/benches/chunks.rs b/benches/chunks.rs index 5cf8b41a1..61d68d2bb 100644 --- a/benches/chunks.rs +++ b/benches/chunks.rs @@ -3,7 +3,6 @@ extern crate test; use test::Bencher; -#[macro_use(azip)] extern crate ndarray; use ndarray::prelude::*; use ndarray::NdProducer; diff --git a/benches/construct.rs b/benches/construct.rs index 4ef4d5223..6909da5e6 100644 --- a/benches/construct.rs +++ b/benches/construct.rs @@ -3,7 +3,6 @@ extern crate test; use test::Bencher; -#[macro_use(s)] extern crate ndarray; use ndarray::prelude::*; diff --git a/benches/higher-order.rs b/benches/higher-order.rs index c249c71b4..22886e4dc 100644 --- a/benches/higher-order.rs +++ b/benches/higher-order.rs @@ -5,7 +5,6 @@ extern crate test; use test::Bencher; use test::black_box; -#[macro_use(s)] extern crate ndarray; use ndarray::prelude::*; diff --git a/benches/iter.rs b/benches/iter.rs index 659d9c8c0..a30c640da 100644 --- a/benches/iter.rs +++ b/benches/iter.rs @@ -6,7 +6,6 @@ use test::Bencher; use test::black_box; use rawpointer::PointerExt; -#[macro_use(s, azip)] extern crate ndarray; use ndarray::prelude::*; use ndarray::{Zip, FoldWhile}; diff --git a/blas-tests/tests/oper.rs b/blas-tests/tests/oper.rs index 4bba0e3ad..80526e4d8 100644 --- a/blas-tests/tests/oper.rs +++ b/blas-tests/tests/oper.rs @@ -1,5 +1,5 @@ -#[macro_use] extern crate defmac; -#[macro_use(s)] extern crate ndarray; +extern crate defmac; +extern crate ndarray; extern crate num_traits; use ndarray::prelude::*; @@ -9,6 +9,7 @@ use ndarray::linalg::general_mat_vec_mul; use ndarray::{Ix, Ixs, SliceInfo, SliceOrIndex}; use std::fmt; +use defmac::defmac; use num_traits::Float; fn assert_approx_eq(f: F, g: F, tol: F) -> bool { diff --git a/examples/axis_ops.rs b/examples/axis_ops.rs index 46a0b3c5d..e1dee54d2 100644 --- a/examples/axis_ops.rs +++ b/examples/axis_ops.rs @@ -1,10 +1,6 @@ - -#[macro_use(s)] extern crate ndarray; -use ndarray::Array; -use ndarray::Dimension; -use ndarray::Axis; +use ndarray::prelude::*; fn regularize(a: &mut Array) -> Result<(), ()> where D: Dimension, diff --git a/examples/column_standardize.rs b/examples/column_standardize.rs index 1e9af1a98..032c520e3 100644 --- a/examples/column_standardize.rs +++ b/examples/column_standardize.rs @@ -1,5 +1,3 @@ - -#[macro_use] extern crate ndarray; use ndarray::prelude::*; diff --git a/examples/convo.rs b/examples/convo.rs index 18a6c7f00..1e6ee0ba6 100644 --- a/examples/convo.rs +++ b/examples/convo.rs @@ -1,5 +1,4 @@ #![allow(unused)] -#[macro_use(s)] extern crate ndarray; extern crate num_traits; diff --git a/examples/life.rs b/examples/life.rs index dd4106e9e..2bb1ccca0 100644 --- a/examples/life.rs +++ b/examples/life.rs @@ -1,4 +1,3 @@ -#[macro_use] extern crate ndarray; use ndarray::prelude::*; diff --git a/examples/rollaxis.rs b/examples/rollaxis.rs index 74e70a8ca..f8c957b66 100644 --- a/examples/rollaxis.rs +++ b/examples/rollaxis.rs @@ -1,5 +1,3 @@ - -#[macro_use] extern crate ndarray; use ndarray::prelude::*; diff --git a/examples/zip_many.rs b/examples/zip_many.rs index 03776d107..5e839d37c 100644 --- a/examples/zip_many.rs +++ b/examples/zip_many.rs @@ -1,5 +1,3 @@ - -#[macro_use] extern crate ndarray; use ndarray::prelude::*; diff --git a/numeric-tests/tests/accuracy.rs b/numeric-tests/tests/accuracy.rs index 83a560f5c..f80792cc7 100644 --- a/numeric-tests/tests/accuracy.rs +++ b/numeric-tests/tests/accuracy.rs @@ -1,5 +1,3 @@ - -#[macro_use(s)] extern crate ndarray; extern crate ndarray_rand; extern crate rand; diff --git a/parallel/benches/rayon.rs b/parallel/benches/rayon.rs index fdd72aab7..76c1789c9 100644 --- a/parallel/benches/rayon.rs +++ b/parallel/benches/rayon.rs @@ -6,8 +6,8 @@ extern crate test; use test::Bencher; extern crate rayon; -#[macro_use] extern crate ndarray; -#[macro_use] extern crate ndarray_parallel; +extern crate ndarray; +extern crate ndarray_parallel; use ndarray::prelude::*; use ndarray_parallel::prelude::*; diff --git a/parallel/src/lib.rs b/parallel/src/lib.rs index 504012b78..74755ba21 100644 --- a/parallel/src/lib.rs +++ b/parallel/src/lib.rs @@ -98,8 +98,10 @@ pub extern crate ndarray; pub extern crate rayon; -/// Into- traits for creating parallelized iterators. +/// Into- traits for creating parallelized iterators and `par_azip` macro. pub mod prelude { + pub use par_azip; + // happy and insane; ignorance is bluss pub use NdarrayIntoParallelIterator; pub use NdarrayIntoParallelRefIterator; diff --git a/parallel/src/zipmacro.rs b/parallel/src/zipmacro.rs index fa2b29c2b..e9d74cffa 100644 --- a/parallel/src/zipmacro.rs +++ b/parallel/src/zipmacro.rs @@ -31,10 +31,10 @@ /// /// ```rust /// extern crate ndarray; -/// #[macro_use(par_azip)] /// extern crate ndarray_parallel; /// /// use ndarray::Array2; +/// use ndarray_parallel::par_azip; /// /// type M = Array2; /// diff --git a/parallel/tests/azip.rs b/parallel/tests/azip.rs index 8773d93fe..32d8f4ba8 100644 --- a/parallel/tests/azip.rs +++ b/parallel/tests/azip.rs @@ -1,10 +1,10 @@ extern crate ndarray; -#[macro_use] extern crate ndarray_parallel; extern crate itertools; use ndarray::prelude::*; +use ndarray_parallel::par_azip; use itertools::{enumerate}; use std::sync::atomic::{AtomicUsize, Ordering}; diff --git a/parallel/tests/rayon.rs b/parallel/tests/rayon.rs index 45b83eb2d..ccae09f0e 100644 --- a/parallel/tests/rayon.rs +++ b/parallel/tests/rayon.rs @@ -1,6 +1,6 @@ extern crate rayon; -#[macro_use(s)] extern crate ndarray; +extern crate ndarray; extern crate ndarray_parallel; use ndarray::prelude::*; diff --git a/serialization-tests/tests/serialize.rs b/serialization-tests/tests/serialize.rs index 9df55c37f..93cf8ce9b 100644 --- a/serialization-tests/tests/serialize.rs +++ b/serialization-tests/tests/serialize.rs @@ -1,6 +1,6 @@ extern crate rustc_serialize as serialize; -#[macro_use] extern crate ndarray; +extern crate ndarray; extern crate serde; @@ -14,7 +14,7 @@ extern crate ron; use serialize::json; -use ndarray::{arr0, arr1, arr2, RcArray, RcArray1, RcArray2, ArrayD, IxDyn}; +use ndarray::{arr0, arr1, arr2, s, RcArray, RcArray1, RcArray2, ArrayD, IxDyn}; #[test] fn serial_many_dim() diff --git a/src/dimension/dimension_trait.rs b/src/dimension/dimension_trait.rs index 78ea9bb2f..206244213 100644 --- a/src/dimension/dimension_trait.rs +++ b/src/dimension/dimension_trait.rs @@ -11,7 +11,7 @@ use std::fmt::Debug; use std::ops::{Index, IndexMut}; use std::ops::{Add, Sub, Mul, AddAssign, SubAssign, MulAssign}; -use itertools::{enumerate, zip}; +use itertools::{enumerate, izip, zip}; use {Ix, Ixs, Ix0, Ix1, Ix2, Ix3, Ix4, Ix5, Ix6, IxDyn, Dim, SliceOrIndex, IxDynImpl}; use IntoDimension; diff --git a/src/dimension/mod.rs b/src/dimension/mod.rs index cc0e77b60..16e758e29 100644 --- a/src/dimension/mod.rs +++ b/src/dimension/mod.rs @@ -8,6 +8,7 @@ use {Ix, Ixs}; use error::{from_kind, ErrorKind, ShapeError}; +use itertools::izip; pub use self::dim::*; pub use self::axis::Axis; @@ -428,6 +429,7 @@ mod test { can_index_slice, can_index_slice_not_custom, max_abs_offset_check_overflow, IntoDimension }; use error::{from_kind, ErrorKind}; + use quickcheck::quickcheck; use {Dimension, Ix0, Ix1, Ix2, Ix3, IxDyn}; #[test] diff --git a/src/doc/ndarray_for_numpy_users/coord_transform.rs b/src/doc/ndarray_for_numpy_users/coord_transform.rs index 4ece3b7b9..1c6468f64 100644 --- a/src/doc/ndarray_for_numpy_users/coord_transform.rs +++ b/src/doc/ndarray_for_numpy_users/coord_transform.rs @@ -49,7 +49,6 @@ //! This is a direct translation to `ndarray`: //! //! ``` -//! #[macro_use] //! extern crate ndarray; //! //! use ndarray::prelude::*; @@ -97,7 +96,6 @@ //! this: //! //! ``` -//! #[macro_use] //! extern crate ndarray; //! //! use ndarray::prelude::*; diff --git a/src/doc/ndarray_for_numpy_users/mod.rs b/src/doc/ndarray_for_numpy_users/mod.rs index 0e46c6850..b268c9b24 100644 --- a/src/doc/ndarray_for_numpy_users/mod.rs +++ b/src/doc/ndarray_for_numpy_users/mod.rs @@ -163,7 +163,6 @@ //! and `ndarray` like this: //! //! ``` -//! #[macro_use] //! extern crate ndarray; //! //! use ndarray::prelude::*; diff --git a/src/doc/ndarray_for_numpy_users/rk_step.rs b/src/doc/ndarray_for_numpy_users/rk_step.rs index fecd6d8ee..a68f6b171 100644 --- a/src/doc/ndarray_for_numpy_users/rk_step.rs +++ b/src/doc/ndarray_for_numpy_users/rk_step.rs @@ -71,7 +71,6 @@ //! A direct translation to `ndarray` looks like this: //! //! ``` -//! #[macro_use] //! extern crate ndarray; //! //! use ndarray::prelude::*; @@ -130,7 +129,6 @@ //! some places, but that's not demonstrated in the example below. //! //! ``` -//! #[macro_use] //! extern crate ndarray; //! //! use ndarray::prelude::*; diff --git a/src/doc/ndarray_for_numpy_users/simple_math.rs b/src/doc/ndarray_for_numpy_users/simple_math.rs index dc588aa83..b6549d3c2 100644 --- a/src/doc/ndarray_for_numpy_users/simple_math.rs +++ b/src/doc/ndarray_for_numpy_users/simple_math.rs @@ -23,7 +23,6 @@ //! //! //! -//! //! a = np.full((5, 4), 3.) //! //! @@ -52,7 +51,6 @@ //! //! //! ``` -//! #[macro_use] //! extern crate ndarray; //! //! use ndarray::prelude::*; diff --git a/src/free_functions.rs b/src/free_functions.rs index 018de0b35..810731efb 100644 --- a/src/free_functions.rs +++ b/src/free_functions.rs @@ -16,9 +16,10 @@ use imp_prelude::*; /// three dimensions. /// /// ``` -/// #[macro_use(array)] /// extern crate ndarray; /// +/// use ndarray::array; +/// /// fn main() { /// let a1 = array![1, 2, 3, 4]; /// @@ -115,10 +116,9 @@ pub fn aview2>(xs: &[V]) -> ArrayView2 { /// Create a one-dimensional read-write array view with elements borrowing `xs`. /// /// ``` -/// #[macro_use(s)] /// extern crate ndarray; /// -/// use ndarray::aview_mut1; +/// use ndarray::{aview_mut1, s}; /// /// // Create an array view over some data, then slice it and modify it. /// fn main() { diff --git a/src/impl_constructors.rs b/src/impl_constructors.rs index 5ef544869..1e8547084 100644 --- a/src/impl_constructors.rs +++ b/src/impl_constructors.rs @@ -370,10 +370,9 @@ impl ArrayBase /// ### Examples /// /// ``` - /// #[macro_use(s)] /// extern crate ndarray; /// - /// use ndarray::Array2; + /// use ndarray::{s, Array2}; /// /// // Example Task: Let's create a column shifted copy of a in b /// diff --git a/src/impl_methods.rs b/src/impl_methods.rs index ce4b64586..63ddbc472 100644 --- a/src/impl_methods.rs +++ b/src/impl_methods.rs @@ -10,7 +10,7 @@ use std::cmp; use std::ptr as std_ptr; use std::slice; -use itertools::zip; +use itertools::{izip, zip}; use imp_prelude::*; diff --git a/src/lib.rs b/src/lib.rs index 80d4cc6ed..b75e233e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -56,7 +56,7 @@ //! + Efficient floating point matrix multiplication even for very large //! matrices; can optionally use BLAS to improve it further. //! + See also the [`ndarray-parallel`] crate for integration with rayon. -//! - **Requires Rust 1.27** +//! - **Requires Rust 1.30** //! //! [`ndarray-parallel`]: https://docs.rs/ndarray-parallel //! @@ -99,12 +99,11 @@ extern crate blas_src; extern crate matrixmultiply; -#[macro_use(izip)] extern crate itertools; +extern crate itertools; extern crate num_traits as libnum; extern crate num_complex; #[cfg(test)] -#[macro_use(quickcheck)] extern crate quickcheck; #[cfg(feature = "docs")] @@ -470,11 +469,9 @@ pub type Ixs = isize; /// [`.slice_collapse()`]: #method.slice_collapse /// /// ``` -/// // import the s![] macro -/// #[macro_use(s)] /// extern crate ndarray; /// -/// use ndarray::{arr2, arr3}; +/// use ndarray::{arr2, arr3, s}; /// /// fn main() { /// @@ -554,9 +551,9 @@ pub type Ixs = isize; /// [`.outer_iter_mut()`]: #method.outer_iter_mut /// /// ``` -/// #[macro_use(s)] extern crate ndarray; +/// extern crate ndarray; /// -/// use ndarray::{arr3, aview1, aview2, Axis}; +/// use ndarray::{arr3, aview1, aview2, s, Axis}; /// /// # fn main() { /// diff --git a/src/prelude.rs b/src/prelude.rs index 9c2813861..28c3c939c 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -8,8 +8,8 @@ //! ndarray prelude. //! -//! This module contains the most used types, type aliases, traits and -//! functions that you can import easily as a group. +//! This module contains the most used types, type aliases, traits, functions, +//! and macros that you can import easily as a group. //! //! ``` //! extern crate ndarray; @@ -55,6 +55,8 @@ pub use { aview_mut1, }; +pub use {array, azip, s}; + #[doc(no_inline)] pub use { ShapeBuilder, diff --git a/src/slice.rs b/src/slice.rs index a1f0bc35b..791364e6b 100644 --- a/src/slice.rs +++ b/src/slice.rs @@ -500,10 +500,9 @@ impl_slicenextdim_larger!((), Slice); /// # Example /// /// ``` -/// #[macro_use] /// extern crate ndarray; /// -/// use ndarray::{Array2, ArrayView2}; +/// use ndarray::{s, Array2, ArrayView2}; /// /// fn laplacian(v: &ArrayView2) -> Array2 { /// -4. * &v.slice(s![1..-1, 1..-1]) @@ -533,7 +532,6 @@ impl_slicenextdim_larger!((), Slice); /// For example, /// /// ``` -/// # #[macro_use] /// # extern crate ndarray; /// # /// # use ndarray::prelude::*; @@ -557,7 +555,7 @@ macro_rules! s( #[allow(unsafe_code)] unsafe { $crate::SliceInfo::new_unchecked( - [$($stack)* s!(@convert r, $s)], + [$($stack)* $crate::s!(@convert r, $s)], out_dim, ) } @@ -572,7 +570,7 @@ macro_rules! s( #[allow(unsafe_code)] unsafe { $crate::SliceInfo::new_unchecked( - [$($stack)* s!(@convert r)], + [$($stack)* $crate::s!(@convert r)], out_dim, ) } @@ -581,19 +579,19 @@ macro_rules! s( }; // convert a..b;c into @convert(a..b, c), final item, trailing comma (@parse $dim:expr, [$($stack:tt)*] $r:expr;$s:expr ,) => { - s![@parse $dim, [$($stack)*] $r;$s] + $crate::s![@parse $dim, [$($stack)*] $r;$s] }; // convert a..b into @convert(a..b), final item, trailing comma (@parse $dim:expr, [$($stack:tt)*] $r:expr ,) => { - s![@parse $dim, [$($stack)*] $r] + $crate::s![@parse $dim, [$($stack)*] $r] }; // convert a..b;c into @convert(a..b, c) (@parse $dim:expr, [$($stack:tt)*] $r:expr;$s:expr, $($t:tt)*) => { match $r { r => { - s![@parse + $crate::s![@parse $crate::SliceNextDim::next_dim(&r, $dim), - [$($stack)* s!(@convert r, $s),] + [$($stack)* $crate::s!(@convert r, $s),] $($t)* ] } @@ -603,9 +601,9 @@ macro_rules! s( (@parse $dim:expr, [$($stack:tt)*] $r:expr, $($t:tt)*) => { match $r { r => { - s![@parse + $crate::s![@parse $crate::SliceNextDim::next_dim(&r, $dim), - [$($stack)* s!(@convert r),] + [$($stack)* $crate::s!(@convert r),] $($t)* ] } @@ -622,6 +620,6 @@ macro_rules! s( ($($t:tt)*) => { // The extra `*&` is a workaround for this compiler bug: // https://github.com/rust-lang/rust/issues/23014 - &*&s![@parse ::std::marker::PhantomData::<$crate::Ix0>, [] $($t)*] + &*&$crate::s![@parse ::std::marker::PhantomData::<$crate::Ix0>, [] $($t)*] }; ); diff --git a/src/stacking.rs b/src/stacking.rs index 5b6060735..b6dffc1a8 100644 --- a/src/stacking.rs +++ b/src/stacking.rs @@ -80,10 +80,9 @@ pub fn stack<'a, A, D>(axis: Axis, arrays: &[ArrayView<'a, A, D>]) /// ***Panics*** if the `stack` function would return an error. /// /// ``` -/// #[macro_use(stack)] /// extern crate ndarray; /// -/// use ndarray::{arr2, Axis}; +/// use ndarray::{arr2, stack, Axis}; /// /// # fn main() { /// diff --git a/src/zip/zipmacro.rs b/src/zip/zipmacro.rs index c33729a91..c836ed52f 100644 --- a/src/zip/zipmacro.rs +++ b/src/zip/zipmacro.rs @@ -49,10 +49,9 @@ /// ## Examples /// /// ```rust -/// #[macro_use(azip)] /// extern crate ndarray; /// -/// use ndarray::{Array1, Array2, Axis}; +/// use ndarray::{azip, Array1, Array2, Axis}; /// /// type M = Array2; /// @@ -118,11 +117,11 @@ macro_rules! azip { // Build Zip Rule (index) (@parse [index => $a:expr, $($aa:expr,)*] $t1:tt in $t2:tt) => { - azip!(@finish ($crate::Zip::indexed($a)) [$($aa,)*] $t1 in $t2) + $crate::azip!(@finish ($crate::Zip::indexed($a)) [$($aa,)*] $t1 in $t2) }; // Build Zip Rule (no index) (@parse [$a:expr, $($aa:expr,)*] $t1:tt in $t2:tt) => { - azip!(@finish ($crate::Zip::from($a)) [$($aa,)*] $t1 in $t2) + $crate::azip!(@finish ($crate::Zip::from($a)) [$($aa,)*] $t1 in $t2) }; // Build Finish Rule (both) (@finish ($z:expr) [$($aa:expr,)*] [$($p:pat,)+] in { $($t:tt)*}) => { @@ -138,32 +137,32 @@ macro_rules! azip { // parsing stack: [expressions] [patterns] (one per operand) // index uses empty [] -- must be first (@parse [] [] index $i:pat, $($t:tt)*) => { - azip!(@parse [index =>] [$i,] $($t)*); + $crate::azip!(@parse [index =>] [$i,] $($t)*); }; (@parse [$($exprs:tt)*] [$($pats:tt)*] mut $x:ident ($e:expr) $($t:tt)*) => { - azip!(@parse [$($exprs)* $e,] [$($pats)* mut $x,] $($t)*); + $crate::azip!(@parse [$($exprs)* $e,] [$($pats)* mut $x,] $($t)*); }; (@parse [$($exprs:tt)*] [$($pats:tt)*] mut $x:ident $($t:tt)*) => { - azip!(@parse [$($exprs)* &mut $x,] [$($pats)* mut $x,] $($t)*); + $crate::azip!(@parse [$($exprs)* &mut $x,] [$($pats)* mut $x,] $($t)*); }; (@parse [$($exprs:tt)*] [$($pats:tt)*] , $($t:tt)*) => { - azip!(@parse [$($exprs)*] [$($pats)*] $($t)*); + $crate::azip!(@parse [$($exprs)*] [$($pats)*] $($t)*); }; (@parse [$($exprs:tt)*] [$($pats:tt)*] ref $x:ident ($e:expr) $($t:tt)*) => { - azip!(@parse [$($exprs)* $e,] [$($pats)* $x,] $($t)*); + $crate::azip!(@parse [$($exprs)* $e,] [$($pats)* $x,] $($t)*); }; (@parse [$($exprs:tt)*] [$($pats:tt)*] ref $x:ident $($t:tt)*) => { - azip!(@parse [$($exprs)* &$x,] [$($pats)* $x,] $($t)*); + $crate::azip!(@parse [$($exprs)* &$x,] [$($pats)* $x,] $($t)*); }; (@parse [$($exprs:tt)*] [$($pats:tt)*] $x:ident ($e:expr) $($t:tt)*) => { - azip!(@parse [$($exprs)* $e,] [$($pats)* &$x,] $($t)*); + $crate::azip!(@parse [$($exprs)* $e,] [$($pats)* &$x,] $($t)*); }; (@parse [$($exprs:tt)*] [$($pats:tt)*] $x:ident $($t:tt)*) => { - azip!(@parse [$($exprs)* &$x,] [$($pats)* &$x,] $($t)*); + $crate::azip!(@parse [$($exprs)* &$x,] [$($pats)* &$x,] $($t)*); }; (@parse [$($exprs:tt)*] [$($pats:tt)*] $($t:tt)*) => { }; ($($t:tt)*) => { - azip!(@parse [] [] $($t)*); + $crate::azip!(@parse [] [] $($t)*); } } diff --git a/tests/array-construct.rs b/tests/array-construct.rs index 463eae980..1355b1258 100644 --- a/tests/array-construct.rs +++ b/tests/array-construct.rs @@ -1,7 +1,7 @@ -#[macro_use] extern crate defmac; extern crate ndarray; +use defmac::defmac; use ndarray::prelude::*; #[test] diff --git a/tests/array.rs b/tests/array.rs index 84aeeeff9..e79a9cdd7 100644 --- a/tests/array.rs +++ b/tests/array.rs @@ -1,8 +1,6 @@ #![allow(non_snake_case)] -#[macro_use] extern crate ndarray; -#[macro_use] extern crate defmac; extern crate itertools; @@ -13,6 +11,7 @@ use ndarray::{ arr3, }; use ndarray::indices; +use defmac::defmac; use itertools::{enumerate, zip}; #[test] diff --git a/tests/azip.rs b/tests/azip.rs index b317b03c4..a5e53e0e0 100644 --- a/tests/azip.rs +++ b/tests/azip.rs @@ -1,4 +1,3 @@ -#[macro_use] extern crate ndarray; extern crate itertools; diff --git a/tests/dimension.rs b/tests/dimension.rs index e10e19bf1..b7b374d72 100644 --- a/tests/dimension.rs +++ b/tests/dimension.rs @@ -1,7 +1,8 @@ extern crate ndarray; -#[macro_use] extern crate defmac; +use defmac::defmac; + use ndarray::{ RcArray, Array, diff --git a/tests/iterator_chunks.rs b/tests/iterator_chunks.rs index 65202fa42..dbbd44082 100644 --- a/tests/iterator_chunks.rs +++ b/tests/iterator_chunks.rs @@ -1,5 +1,3 @@ - -#[macro_use(array, s)] extern crate ndarray; use ndarray::prelude::*; diff --git a/tests/iterators.rs b/tests/iterators.rs index c64dd8068..916db7fd2 100644 --- a/tests/iterators.rs +++ b/tests/iterators.rs @@ -1,19 +1,9 @@ -#[macro_use(s)] extern crate ndarray; extern crate itertools; use ndarray::prelude::*; use ndarray::Ix; -use ndarray::{ - Data, - Dimension, - aview1, - arr2, - arr3, - Axis, - indices, - Slice, -}; +use ndarray::{arr2, arr3, aview1, indices, s, Axis, Data, Dimension, Slice}; use itertools::assert_equal; use itertools::{rev, enumerate}; diff --git a/tests/oper.rs b/tests/oper.rs index 790c6df54..392b0e530 100644 --- a/tests/oper.rs +++ b/tests/oper.rs @@ -1,5 +1,5 @@ -#[macro_use] extern crate defmac; -#[macro_use(s)] extern crate ndarray; +extern crate defmac; +extern crate ndarray; extern crate num_traits; use ndarray::prelude::*; @@ -11,6 +11,7 @@ use ndarray::{Ix, Ixs, SliceInfo, SliceOrIndex}; use std::fmt; use std::ops::Neg; +use defmac::defmac; use num_traits::Float; fn test_oper(op: &str, a: &[f32], b: &[f32], c: &[f32]) diff --git a/tests/s.rs b/tests/s.rs index 5681b022e..2705b649e 100644 --- a/tests/s.rs +++ b/tests/s.rs @@ -1,8 +1,6 @@ - -#[macro_use(s)] extern crate ndarray; -use ndarray::Array; +use ndarray::{s, Array}; #[test] fn test_s() diff --git a/tests/stacking.rs b/tests/stacking.rs index 4204ee48c..267714f70 100644 --- a/tests/stacking.rs +++ b/tests/stacking.rs @@ -1,11 +1,10 @@ - -#[macro_use(stack)] extern crate ndarray; use ndarray::{ aview1, arr2, + stack, Axis, Array2, ErrorKind, diff --git a/tests/windows.rs b/tests/windows.rs index 095ea3654..1155be4a0 100644 --- a/tests/windows.rs +++ b/tests/windows.rs @@ -1,5 +1,3 @@ - -#[macro_use(s)] extern crate ndarray; extern crate itertools;