Repository: rust-itertools/itertools
Pull request #416 (2020-03-02 19:43:54)

Migration to 2018 edition.


Patch:
diff --git a/Cargo.toml b/Cargo.toml
index 02a2ad9..94c12e6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,8 @@ keywords = ["iterator", "data-structure", "zip", "product", "group-by"]
 categories = ["algorithms", "rust-patterns"]
 exclude = ["/bors.toml"]
 
+edition = "2018"
+
 [package.metadata.release]
 no-dev-version = true
 
diff --git a/README.rst b/README.rst
index 1874edf..24c99d3 100644
--- a/README.rst
+++ b/README.rst
@@ -27,8 +27,6 @@ How to use in your crate:
 
 .. code:: rust
 
-    #[macro_use] extern crate itertools;
-
     use itertools::Itertools;
 
 How to contribute
diff --git a/benches/bench1.rs b/benches/bench1.rs
index 751743d..71278d1 100644
--- a/benches/bench1.rs
+++ b/benches/bench1.rs
@@ -1,9 +1,7 @@
-extern crate criterion;
-#[macro_use] extern crate itertools;
-
 use criterion::{black_box, criterion_group, criterion_main, Criterion};
 use itertools::Itertools;
 use itertools::free::cloned;
+use itertools::iproduct;
 
 use std::iter::repeat;
 use std::cmp;
@@ -11,7 +9,7 @@ use std::ops::{Add, Range};
 
 mod extra;
 
-use extra::ZipSlices;
+use crate::extra::ZipSlices;
 
 fn slice_iter(c: &mut Criterion) {
     let xs: Vec<_> = repeat(1i32).take(20).collect();
diff --git a/benches/combinations_with_replacement.rs b/benches/combinations_with_replacement.rs
index 5374fe9..8e4fa3d 100644
--- a/benches/combinations_with_replacement.rs
+++ b/benches/combinations_with_replacement.rs
@@ -1,6 +1,3 @@
-extern crate criterion;
-extern crate itertools;
-
 use criterion::{black_box, criterion_group, criterion_main, Criterion};
 use itertools::Itertools;
 
diff --git a/benches/fold_specialization.rs b/benches/fold_specialization.rs
index 28bacbd..53319a5 100644
--- a/benches/fold_specialization.rs
+++ b/benches/fold_specialization.rs
@@ -1,6 +1,3 @@
-extern crate criterion;
-extern crate itertools;
-
 use criterion::{criterion_group, criterion_main, Criterion};
 use itertools::Itertools;
 
diff --git a/benches/tree_fold1.rs b/benches/tree_fold1.rs
index d3c212d..f12995d 100644
--- a/benches/tree_fold1.rs
+++ b/benches/tree_fold1.rs
@@ -1,6 +1,3 @@
-extern crate criterion;
-extern crate itertools;
-
 use criterion::{criterion_group, criterion_main, Criterion};
 use itertools::{Itertools, cloned};
 
diff --git a/benches/tuple_combinations.rs b/benches/tuple_combinations.rs
index 37ff8bc..84411ef 100644
--- a/benches/tuple_combinations.rs
+++ b/benches/tuple_combinations.rs
@@ -1,6 +1,3 @@
-extern crate criterion;
-extern crate itertools;
-
 use criterion::{black_box, criterion_group, criterion_main, Criterion};
 use itertools::Itertools;
 
diff --git a/benches/tuples.rs b/benches/tuples.rs
index 8545ad1..ea50aaa 100644
--- a/benches/tuples.rs
+++ b/benches/tuples.rs
@@ -1,6 +1,3 @@
-extern crate criterion;
-extern crate itertools;
-
 use criterion::{criterion_group, criterion_main, Criterion};
 use itertools::Itertools;
 
diff --git a/examples/iris.rs b/examples/iris.rs
index be3cd67..25ab373 100644
--- a/examples/iris.rs
+++ b/examples/iris.rs
@@ -3,10 +3,6 @@
 /// and does some simple manipulations.
 ///
 /// Iterators and itertools functionality are used throughout.
-///
-///
-
-extern crate itertools;
 
 use itertools::Itertools;
 use std::collections::HashMap;
diff --git a/src/adaptors/mod.rs b/src/adaptors/mod.rs
index aaf73b9..7d61f11 100644
--- a/src/adaptors/mod.rs
+++ b/src/adaptors/mod.rs
@@ -12,7 +12,7 @@ use std::fmt;
 use std::mem::replace;
 use std::iter::{Fuse, Peekable, FromIterator};
 use std::marker::PhantomData;
-use size_hint;
+use crate::size_hint;
 
 /// An iterator adaptor that alternates elements from two iterators until both
 /// run out.
diff --git a/src/adaptors/multi_product.rs b/src/adaptors/multi_product.rs
index a8a70f8..4a31713 100644
--- a/src/adaptors/multi_product.rs
+++ b/src/adaptors/multi_product.rs
@@ -1,7 +1,7 @@
 #![cfg(feature = "use_std")]
 
-use size_hint;
-use Itertools;
+use crate::size_hint;
+use crate::Itertools;
 
 #[derive(Clone)]
 /// An iterator adaptor that iterates over the cartesian product of
diff --git a/src/concat_impl.rs b/src/concat_impl.rs
index 05b370e..6048d18 100644
--- a/src/concat_impl.rs
+++ b/src/concat_impl.rs
@@ -1,4 +1,4 @@
-use Itertools;
+use crate::Itertools;
 
 /// Combine all an iterator's elements into one element by using `Extend`.
 ///
diff --git a/src/diff.rs b/src/diff.rs
index 2951bc4..c196d8d 100644
--- a/src/diff.rs
+++ b/src/diff.rs
@@ -5,8 +5,8 @@
 //! describes the difference between two non-`Clone` iterators `I` and `J` after breaking ASAP from
 //! a lock-step comparison.
 
-use free::put_back;
-use structs::PutBack;
+use crate::free::put_back;
+use crate::structs::PutBack;
 
 /// A type returned by the [`diff_with`](./fn.diff_with.html) function.
 ///
diff --git a/src/either_or_both.rs b/src/either_or_both.rs
index 03130b1..3115c37 100644
--- a/src/either_or_both.rs
+++ b/src/either_or_both.rs
@@ -1,4 +1,4 @@
-use EitherOrBoth::*;
+use crate::EitherOrBoth::*;
 
 use either::Either;
 
diff --git a/src/exactly_one_err.rs b/src/exactly_one_err.rs
index 6b7bad5..e4925ff 100644
--- a/src/exactly_one_err.rs
+++ b/src/exactly_one_err.rs
@@ -1,6 +1,6 @@
 use std::iter::ExactSizeIterator;
 
-use size_hint;
+use crate::size_hint;
 
 /// Iterator returned for the error case of `IterTools::exactly_one()`
 /// This iterator yields exactly the same elements as the input iterator.
diff --git a/src/free.rs b/src/free.rs
index 2bc72a9..a6bc1bd 100644
--- a/src/free.rs
+++ b/src/free.rs
@@ -10,23 +10,23 @@ use std::iter::{self, Zip};
 type VecIntoIter<T> = ::std::vec::IntoIter<T>;
 
 #[cfg(feature = "use_std")]
-use Itertools;
+use crate::Itertools;
 
-pub use adaptors::{
+pub use crate::adaptors::{
     interleave,
     merge,
     put_back,
 };
 #[cfg(feature = "use_std")]
-pub use put_back_n_impl::put_back_n;
+pub use crate::put_back_n_impl::put_back_n;
 #[cfg(feature = "use_std")]
-pub use multipeek_impl::multipeek;
+pub use crate::multipeek_impl::multipeek;
 #[cfg(feature = "use_std")]
-pub use kmerge_impl::kmerge;
-pub use zip_eq_impl::zip_eq;
-pub use merge_join::merge_join_by;
+pub use crate::kmerge_impl::kmerge;
+pub use crate::zip_eq_impl::zip_eq;
+pub use crate::merge_join::merge_join_by;
 #[cfg(feature = "use_std")]
-pub use rciter_impl::rciter;
+pub use crate::rciter_impl::rciter;
 
 /// Iterate `iterable` with a running index.
 ///
diff --git a/src/kmerge_impl.rs b/src/kmerge_impl.rs
index 31e0894..8f68aeb 100644
--- a/src/kmerge_impl.rs
+++ b/src/kmerge_impl.rs
@@ -1,6 +1,5 @@
-
-use size_hint;
-use Itertools;
+use crate::size_hint;
+use crate::Itertools;
 
 use std::mem::replace;
 use std::fmt;
diff --git a/src/lib.rs b/src/lib.rs
index ad7f12d..b8daefd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -47,8 +47,6 @@
 //! [`Iterator`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html
 #![doc(html_root_url="https://docs.rs/itertools/0.8/")]
 
-extern crate either;
-
 #[cfg(not(feature = "use_std"))]
 extern crate core as std;
 
@@ -77,7 +75,7 @@ pub use std::iter as __std_iter;
 
 /// The concrete iterator types.
 pub mod structs {
-    pub use adaptors::{
+    pub use crate::adaptors::{
         Dedup,
         DedupBy,
         Interleave,
@@ -97,75 +95,75 @@ pub mod structs {
         Update,
     };
     #[allow(deprecated)]
-    pub use adaptors::Step;
+    pub use crate::adaptors::Step;
     #[cfg(feature = "use_std")]
-    pub use adaptors::MultiProduct;
+    pub use crate::adaptors::MultiProduct;
     #[cfg(feature = "use_std")]
-    pub use combinations::Combinations;
+    pub use crate::combinations::Combinations;
     #[cfg(feature = "use_std")]
-    pub use combinations_with_replacement::CombinationsWithReplacement;
-    pub use cons_tuples_impl::ConsTuples;
-    pub use exactly_one_err::ExactlyOneError;
-    pub use format::{Format, FormatWith};
+    pub use crate::combinations_with_replacement::CombinationsWithReplacement;
+    pub use crate::cons_tuples_impl::ConsTuples;
+    pub use crate::exactly_one_err::ExactlyOneError;
+    pub use crate::format::{Format, FormatWith};
     #[cfg(feature = "use_std")]
-    pub use groupbylazy::{IntoChunks, Chunk, Chunks, GroupBy, Group, Groups};
-    pub use intersperse::Intersperse;
+    pub use crate::groupbylazy::{IntoChunks, Chunk, Chunks, GroupBy, Group, Groups};
+    pub use crate::intersperse::Intersperse;
     #[cfg(feature = "use_std")]
-    pub use kmerge_impl::{KMerge, KMergeBy};
-    pub use merge_join::MergeJoinBy;
+    pub use crate::kmerge_impl::{KMerge, KMergeBy};
+    pub use crate::merge_join::MergeJoinBy;
     #[cfg(feature = "use_std")]
-    pub use multipeek_impl::MultiPeek;
-    pub use pad_tail::PadUsing;
-    pub use peeking_take_while::PeekingTakeWhile;
+    pub use crate::multipeek_impl::MultiPeek;
+    pub use crate::pad_tail::PadUsing;
+    pub use crate::peeking_take_while::PeekingTakeWhile;
     #[cfg(feature = "use_std")]
-    pub use permutations::Permutations;
-    pub use process_results_impl::ProcessResults;
+    pub use crate::permutations::Permutations;
+    pub use crate::process_results_impl::ProcessResults;
     #[cfg(feature = "use_std")]
-    pub use put_back_n_impl::PutBackN;
+    pub use crate::put_back_n_impl::PutBackN;
     #[cfg(feature = "use_std")]
-    pub use rciter_impl::RcIter;
-    pub use repeatn::RepeatN;
+    pub use crate::rciter_impl::RcIter;
+    pub use crate::repeatn::RepeatN;
     #[allow(deprecated)]
-    pub use sources::{RepeatCall, Unfold, Iterate};
+    pub use crate::sources::{RepeatCall, Unfold, Iterate};
     #[cfg(feature = "use_std")]
-    pub use tee::Tee;
-    pub use tuple_impl::{TupleBuffer, TupleWindows, Tuples};
+    pub use crate::tee::Tee;
+    pub use crate::tuple_impl::{TupleBuffer, TupleWindows, Tuples};
     #[cfg(feature = "use_std")]
-    pub use unique_impl::{Unique, UniqueBy};
-    pub use with_position::WithPosition;
-    pub use zip_eq_impl::ZipEq;
-    pub use zip_longest::ZipLongest;
-    pub use ziptuple::Zip;
+    pub use crate::unique_impl::{Unique, UniqueBy};
+    pub use crate::with_position::WithPosition;
+    pub use crate::zip_eq_impl::ZipEq;
+    pub use crate::zip_longest::ZipLongest;
+    pub use crate::ziptuple::Zip;
 }
 
 /// Traits helpful for using certain `Itertools` methods in generic contexts.
 pub mod traits {
-    pub use ::tuple_impl::HomogeneousTuple;
+    pub use crate::tuple_impl::HomogeneousTuple;
 }
 
 #[allow(deprecated)]
-pub use structs::*;
-pub use concat_impl::concat;
-pub use cons_tuples_impl::cons_tuples;
-pub use diff::diff_with;
-pub use diff::Diff;
+pub use crate::structs::*;
+pub use crate::concat_impl::concat;
+pub use crate::cons_tuples_impl::cons_tuples;
+pub use crate::diff::diff_with;
+pub use crate::diff::Diff;
 #[cfg(feature = "use_std")]
-pub use kmerge_impl::{kmerge_by};
-pub use minmax::MinMaxResult;
-pub use peeking_take_while::PeekingNext;
-pub use process_results_impl::process_results;
-pub use repeatn::repeat_n;
+pub use crate::kmerge_impl::{kmerge_by};
+pub use crate::minmax::MinMaxResult;
+pub use crate::peeking_take_while::PeekingNext;
+pub use crate::process_results_impl::process_results;
+pub use crate::repeatn::repeat_n;
 #[allow(deprecated)]
-pub use sources::{repeat_call, unfold, iterate};
-pub use with_position::Position;
-pub use ziptuple::multizip;
+pub use crate::sources::{repeat_call, unfold, iterate};
+pub use crate::with_position::Position;
+pub use crate::ziptuple::multizip;
 mod adaptors;
 mod either_or_both;
-pub use either_or_both::EitherOrBoth;
+pub use crate::either_or_both::EitherOrBoth;
 #[doc(hidden)]
 pub mod free;
 #[doc(inline)]
-pub use free::*;
+pub use crate::free::*;
 mod concat_impl;
 mod cons_tuples_impl;
 #[cfg(feature = "use_std")]
@@ -217,7 +215,8 @@ mod ziptuple;
 /// from iterators `(I, J, ..., M)` with element types `I::Item = A`, `J::Item = B`, etc.
 ///
 /// ```
-/// #[macro_use] extern crate itertools;
+/// # use itertools::iproduct;
+/// #
 /// # fn main() {
 /// // Iterate over the coordinates of a 4 x 4 x 4 grid
 /// // from (0, 0, 0), (0, 0, 1), .., (0, 1, 0), (0, 1, 1), .. etc until (3, 3, 3)
@@ -226,14 +225,6 @@ mod ziptuple;
 /// }
 /// # }
 /// ```
-///
-/// **Note:** To enable the macros in this crate, use the `#[macro_use]`
-/// attribute when importing the crate:
-///
-/// ```
-/// #[macro_use] extern crate itertools;
-/// # fn main() { }
-/// ```
 macro_rules! iproduct {
     (@flatten $I:expr,) => (
         $I
@@ -274,7 +265,8 @@ macro_rules! iproduct {
 /// [`multizip`]: fn.multizip.html
 ///
 /// ```
-/// #[macro_use] extern crate itertools;
+/// # use itertools::izip;
+/// #
 /// # fn main() {
 ///
 /// // iterate over three sequences side-by-side
@@ -288,14 +280,6 @@ macro_rules! iproduct {
 /// assert_eq!(results, [0 + 3, 10 + 7, 29, 36]);
 /// # }
 /// ```
-///
-/// **Note:** To enable the macros in this crate, use the `#[macro_use]`
-/// attribute when importing the crate:
-///
-/// ```
-/// #[macro_use] extern crate itertools;
-/// # fn main() { }
-/// ```
 macro_rules! izip {
     // @closure creates a tuple-flattening closure for .map() call. usage:
     // @closure partial_pattern => partial_tuple , rest , of , iterators
@@ -2467,7 +2451,7 @@ pub trait Itertools : Iterator {
     fn position_minmax(self) -> MinMaxResult<usize>
         where Self: Sized, Self::Item: PartialOrd
     {
-        use MinMaxResult::{NoElements, OneElement, MinMax};
+        use crate::MinMaxResult::{NoElements, OneElement, MinMax};
         match minmax::minmax_impl(self.enumerate(), |_| (), |x, y, _, _| x.1 < y.1) {
             NoElements => NoElements,
             OneElement(x) => OneElement(x.0),
@@ -2513,7 +2497,7 @@ pub trait Itertools : Iterator {
     fn position_minmax_by_key<K, F>(self, mut key: F) -> MinMaxResult<usize>
         where Self: Sized, K: PartialOrd, F: FnMut(&Self::Item) -> K
     {
-        use MinMaxResult::{NoElements, OneElement, MinMax};
+        use crate::MinMaxResult::{NoElements, OneElement, MinMax};
         match self.enumerate().minmax_by_key(|e| key(&e.1)) {
             NoElements => NoElements,
             OneElement(x) => OneElement(x.0),
@@ -2556,7 +2540,7 @@ pub trait Itertools : Iterator {
     fn position_minmax_by<F>(self, mut compare: F) -> MinMaxResult<usize>
         where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Ordering
     {
-        use MinMaxResult::{NoElements, OneElement, MinMax};
+        use crate::MinMaxResult::{NoElements, OneElement, MinMax};
         match self.enumerate().minmax_by(|x, y| compare(&x.1, &y.1)) {
             NoElements => NoElements,
             OneElement(x) => OneElement(x.0),
diff --git a/src/merge_join.rs b/src/merge_join.rs
index 19b4af2..0f87ae4 100644
--- a/src/merge_join.rs
+++ b/src/merge_join.rs
@@ -3,7 +3,7 @@ use std::iter::Fuse;
 use std::fmt;
 
 use super::adaptors::{PutBack, put_back};
-use either_or_both::EitherOrBoth;
+use crate::either_or_both::EitherOrBoth;
 
 /// Return an iterator adaptor that merge-joins items from the two base iterators in ascending order.
 ///
diff --git a/src/multipeek_impl.rs b/src/multipeek_impl.rs
index a6a2fb3..0b64e1d 100644
--- a/src/multipeek_impl.rs
+++ b/src/multipeek_impl.rs
@@ -1,9 +1,7 @@
-
-
 use std::iter::Fuse;
 use std::collections::VecDeque;
-use size_hint;
-use PeekingNext;
+use crate::size_hint;
+use crate::PeekingNext;
 
 /// See [`multipeek()`](../fn.multipeek.html) for more information.
 #[derive(Clone, Debug)]
diff --git a/src/pad_tail.rs b/src/pad_tail.rs
index 4c5b202..8d9d5ff 100644
--- a/src/pad_tail.rs
+++ b/src/pad_tail.rs
@@ -1,5 +1,5 @@
 use std::iter::Fuse;
-use size_hint;
+use crate::size_hint;
 
 /// An iterator adaptor that pads a sequence to a minimum length by filling
 /// missing elements using a closure.
diff --git a/src/peeking_take_while.rs b/src/peeking_take_while.rs
index bff0403..b404904 100644
--- a/src/peeking_take_while.rs
+++ b/src/peeking_take_while.rs
@@ -1,8 +1,7 @@
-
 use std::iter::Peekable;
-use PutBack;
+use crate::PutBack;
 #[cfg(feature = "use_std")]
-use PutBackN;
+use crate::PutBackN;
 
 /// An iterator that allows peeking at an element before deciding to accept it.
 ///
diff --git a/src/put_back_n_impl.rs b/src/put_back_n_impl.rs
index cc08320..dcb2894 100644
--- a/src/put_back_n_impl.rs
+++ b/src/put_back_n_impl.rs
@@ -1,4 +1,4 @@
-use size_hint;
+use crate::size_hint;
 
 /// An iterator adaptor that allows putting multiple
 /// items in front of the iterator.
diff --git a/src/zip_longest.rs b/src/zip_longest.rs
index 68a381a..1395c84 100644
--- a/src/zip_longest.rs
+++ b/src/zip_longest.rs
@@ -2,7 +2,7 @@ use std::cmp::Ordering::{Equal, Greater, Less};
 use super::size_hint;
 use std::iter::Fuse;
 
-use either_or_both::EitherOrBoth;
+use crate::either_or_both::EitherOrBoth;
 
 // ZipLongest originally written by SimonSapin,
 // and dedicated to itertools https://github.com/rust-lang/rust/pull/19283


Test patch:
diff --git a/tests/adaptors_no_collect.rs b/tests/adaptors_no_collect.rs
index 4da6fcf..a47f906 100644
--- a/tests/adaptors_no_collect.rs
+++ b/tests/adaptors_no_collect.rs
@@ -1,5 +1,3 @@
-extern crate itertools;
-
 use itertools::Itertools;
 
 struct PanickingCounter {
diff --git a/tests/fold_specialization.rs b/tests/fold_specialization.rs
index ac5d6a2..a984b40 100644
--- a/tests/fold_specialization.rs
+++ b/tests/fold_specialization.rs
@@ -1,5 +1,3 @@
-extern crate itertools;
-
 use itertools::Itertools;
 
 #[test]
diff --git a/tests/merge_join.rs b/tests/merge_join.rs
index 4182920..3280b7d 100644
--- a/tests/merge_join.rs
+++ b/tests/merge_join.rs
@@ -1,5 +1,3 @@
-extern crate itertools;
-
 use itertools::EitherOrBoth;
 use itertools::free::merge_join_by;
 
diff --git a/tests/peeking_take_while.rs b/tests/peeking_take_while.rs
index 45c76c2..a114702 100644
--- a/tests/peeking_take_while.rs
+++ b/tests/peeking_take_while.rs
@@ -1,6 +1,3 @@
-
-extern crate itertools;
-
 use itertools::Itertools;
 use itertools::{put_back, put_back_n};
 
diff --git a/tests/quick.rs b/tests/quick.rs
index c78c3dc..683ba7a 100644
--- a/tests/quick.rs
+++ b/tests/quick.rs
@@ -3,14 +3,8 @@
 //!
 //! In particular we test the tedious size_hint and exact size correctness.
 
-#[macro_use] extern crate itertools;
-
-extern crate quickcheck;
-extern crate rand;
-
-use std::default::Default;
-
 use quickcheck as qc;
+use std::default::Default;
 use std::ops::Range;
 use std::cmp::{max, min, Ordering};
 use std::collections::HashSet;
@@ -18,6 +12,8 @@ use itertools::Itertools;
 use itertools::{
     multizip,
     EitherOrBoth,
+    iproduct,
+    izip,
 };
 use itertools::free::{
     cloned,
diff --git a/tests/specializations.rs b/tests/specializations.rs
index 195be90..ef51bbe 100644
--- a/tests/specializations.rs
+++ b/tests/specializations.rs
@@ -1,12 +1,7 @@
-extern crate itertools;
-
-#[macro_use]
-extern crate quickcheck;
-
 use itertools::{EitherOrBoth, Itertools};
-
 use std::fmt::Debug;
 use std::ops::BitXor;
+use quickcheck::quickcheck;
 
 struct Unspecialized<I>(I);
 impl<I> Iterator for Unspecialized<I>
diff --git a/tests/test_core.rs b/tests/test_core.rs
index b1e03cf..5861653 100644
--- a/tests/test_core.rs
+++ b/tests/test_core.rs
@@ -5,14 +5,14 @@
 //! except according to those terms.
 #![no_std]
 
-#[macro_use] extern crate itertools as it;
-
 use core::iter;
-
-use it::Itertools;
-use it::interleave;
-use it::multizip;
-use it::free::put_back;
+use itertools as it;
+use crate::it::Itertools;
+use crate::it::interleave;
+use crate::it::multizip;
+use crate::it::free::put_back;
+use crate::it::iproduct;
+use crate::it::izip;
 
 #[test]
 fn product2() {
diff --git a/tests/test_std.rs b/tests/test_std.rs
index baea2ea..ba07784 100644
--- a/tests/test_std.rs
+++ b/tests/test_std.rs
@@ -1,14 +1,14 @@
-
-#[macro_use] extern crate itertools as it;
-extern crate permutohedron;
-
-use it::Itertools;
-use it::multizip;
-use it::multipeek;
-use it::free::rciter;
-use it::free::put_back_n;
-use it::FoldWhile;
-use it::cloned;
+use permutohedron;
+use itertools as it;
+use crate::it::Itertools;
+use crate::it::multizip;
+use crate::it::multipeek;
+use crate::it::free::rciter;
+use crate::it::free::put_back_n;
+use crate::it::FoldWhile;
+use crate::it::cloned;
+use crate::it::iproduct;
+use crate::it::izip;
 
 #[test]
 fn product3() {
@@ -186,7 +186,7 @@ fn test_rciter() {
 #[allow(deprecated)]
 #[test]
 fn trait_pointers() {
-    struct ByRef<'r, I: ?Sized>(&'r mut I) where I: 'r;
+    struct ByRef<'r, I: ?Sized>(&'r mut I) ;
 
     impl<'r, X, I: ?Sized> Iterator for ByRef<'r, I> where
         I: 'r + Iterator<Item=X>
@@ -347,7 +347,7 @@ fn test_multipeek_reset() {
 
 #[test]
 fn test_multipeek_peeking_next() {
-    use it::PeekingNext;
+    use crate::it::PeekingNext;
     let nums = vec![1u8,2,3,4,5,6,7];
 
     let mut mp = multipeek(nums.iter().map(|&x| x));
@@ -685,7 +685,7 @@ fn diff_shorter() {
 #[test]
 fn minmax() {
     use std::cmp::Ordering;
-    use it::MinMaxResult;
+    use crate::it::MinMaxResult;
 
     // A peculiar type: Equality compares both tuple items, but ordering only the
     // first item.  This is so we can check the stability property easily.
diff --git a/tests/tuples.rs b/tests/tuples.rs
index 07dba57..9fc8b3c 100644
--- a/tests/tuples.rs
+++ b/tests/tuples.rs
@@ -1,5 +1,3 @@
-extern crate itertools;
-
 use itertools::Itertools;
 
 #[test]
diff --git a/tests/zip.rs b/tests/zip.rs
index c5c5189..b1af52c 100644
--- a/tests/zip.rs
+++ b/tests/zip.rs
@@ -1,5 +1,3 @@
-extern crate itertools;
-
 use itertools::Itertools;
 use itertools::EitherOrBoth::{Both, Left, Right};
 use itertools::free::zip_eq;