diff --git a/src/check.rs b/src/check.rs index 91d9b9cfed29a7d59861770be4cf9d216d570ef6..2927991d9e481af6916eff17b2fbf7fdd3ab72b8 100644 --- a/src/check.rs +++ b/src/check.rs @@ -6,8 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate git_workarea; -use self::git_workarea::CommitId; +use crates::git_workarea::CommitId; use commit::Commit; use context::CheckGitContext; diff --git a/src/checks/allow_robot.rs b/src/checks/allow_robot.rs index aa10336738cd77c4cf2b32d40df08f878740b344..3322cd4e102fbf00829a952f251c0803baf93ef8 100644 --- a/src/checks/allow_robot.rs +++ b/src/checks/allow_robot.rs @@ -44,8 +44,7 @@ impl BranchCheck for AllowRobot { #[cfg(test)] mod tests { - extern crate git_workarea; - pub use self::git_workarea::Identity; + use crates::git_workarea::Identity; use checks::AllowRobot; use checks::test::*; diff --git a/src/checks/check_whitespace.rs b/src/checks/check_whitespace.rs index ad954d6665b6479205f218c5eefdee639b538461..a4a7525121261109be0f3062d61a602796d67703 100644 --- a/src/checks/check_whitespace.rs +++ b/src/checks/check_whitespace.rs @@ -6,8 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate itertools; -use self::itertools::Itertools; +use crates::itertools::Itertools; use impl_prelude::*; diff --git a/src/checks/formatting.rs b/src/checks/formatting.rs index 69370eb150a284f47ddaa26e2632efbb3cb69e94..4811c1f326cd1627fecea64b1b2aa73f3efba4ba 100644 --- a/src/checks/formatting.rs +++ b/src/checks/formatting.rs @@ -6,11 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate itertools; -use self::itertools::Itertools; - -extern crate rayon; -use self::rayon::prelude::*; +use crates::itertools::Itertools; +use crates::rayon::prelude::*; use impl_prelude::*; diff --git a/src/checks/test.rs b/src/checks/test.rs index 55201cd243b9d03a44c6fd5e96057d12b51c1ba9..c2ee002699a2578d55f79c1b661c995ba0914f44 100644 --- a/src/checks/test.rs +++ b/src/checks/test.rs @@ -6,11 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate git_workarea; -use self::git_workarea::{CommitId, GitContext, Identity}; - -extern crate tempdir; -use self::tempdir::TempDir; +use crates::git_workarea::{CommitId, GitContext, Identity}; +use crates::tempdir::TempDir; use check::CheckResult; pub use run::GitCheckConfiguration; diff --git a/src/commit.rs b/src/commit.rs index 66d582255fa44b1178fd8ac2058fe43002e2b827..f4efededef4853f23e6942ec1d65fab6f9f6ed6c 100644 --- a/src/commit.rs +++ b/src/commit.rs @@ -6,14 +6,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate itertools; -use self::itertools::{Itertools, multizip}; - -extern crate git_workarea; -use self::git_workarea::{CommitId, GitContext, Identity}; - -extern crate regex; -use self::regex::Regex; +use crates::itertools::{Itertools, multizip}; +use crates::git_workarea::{CommitId, GitContext, Identity}; +use crates::regex::Regex; use error::*; @@ -432,8 +427,7 @@ fn parse_octal<I>(iter: &mut I, digit: u8) -> u8 #[cfg(test)] mod tests { - extern crate git_workarea; - use self::git_workarea::{CommitId, GitContext, Identity}; + use crates::git_workarea::{CommitId, GitContext, Identity}; use commit::{Commit, StatusChange}; diff --git a/src/context.rs b/src/context.rs index e6a7c3eea80dbe9db333170529aae462e797ed0e..9420f4d6579d1a683ab74b9fd6c25c880d565704 100644 --- a/src/context.rs +++ b/src/context.rs @@ -6,8 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate git_workarea; -use self::git_workarea::{GitWorkArea, Identity, SubmoduleConfig}; +use crates::git_workarea::{GitWorkArea, Identity, SubmoduleConfig}; use error::*; @@ -126,8 +125,7 @@ impl CheckGitContext { #[cfg(test)] mod tests { - extern crate git_workarea; - use self::git_workarea::{CommitId, GitContext, Identity}; + use crates::git_workarea::{CommitId, GitContext, Identity}; use super::*; diff --git a/src/error.rs b/src/error.rs index 55e9130a91dcb43dc2f49c14340cb35edd9a0ab9..ef15b0969912d5daae10c45bbeecf4c668fb8b4a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -6,7 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate git_workarea; +use crates::git_workarea; error_chain! { links { diff --git a/src/impl_prelude.rs b/src/impl_prelude.rs index d67ad724cce71ccb679fcc0d5e4be480350d14dd..24a45c84b2379e83ddfcd28083f9fed737d958c4 100644 --- a/src/impl_prelude.rs +++ b/src/impl_prelude.rs @@ -8,9 +8,8 @@ //! Module for importing all types and traits for implementing checks. -extern crate git_workarea; -pub use self::git_workarea::CommitId; -pub use self::git_workarea::Identity; +pub use crates::git_workarea::CommitId; +pub use crates::git_workarea::Identity; pub use commit::Commit; pub use commit::DiffInfo; diff --git a/src/lib.rs b/src/lib.rs index 05319dcc06ba3ef84f2d7f0748fda02fa88411de..82bab930ba79b217ee09d2763a6a883bccf7f88b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,6 +23,20 @@ extern crate lazy_static; #[macro_use] extern crate log; +mod crates { + // public + // pub extern crate error_chain; + pub extern crate git_workarea; + + // private + pub extern crate itertools; + pub extern crate rayon; + pub extern crate regex; + + #[cfg(test)] + pub extern crate tempdir; +} + mod commit; mod context; mod check; diff --git a/src/run.rs b/src/run.rs index 696a14699bc1ddeaedd18c16832aa6ea648c49a8..978de70e99cba7749b043ad8c739434b041a72ba 100644 --- a/src/run.rs +++ b/src/run.rs @@ -6,11 +6,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate git_workarea; -use self::git_workarea::{CommitId, GitContext, Identity}; - -extern crate rayon; -use self::rayon::prelude::*; +use crates::git_workarea::{CommitId, GitContext, Identity}; +use crates::rayon::prelude::*; use check::{BranchCheck, Check, CheckResult}; use commit::Commit; diff --git a/src/utils.rs b/src/utils.rs index 635194bb627b914047690cebac2dfaf26f19f8ad..352f1964daa3910ed9527e37b3acee4ae3a13976 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -6,8 +6,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate git_workarea; -use self::git_workarea::GitContext; +use crates::git_workarea::GitContext; use context::CheckGitContext;