From 1a4c197e9d93d705c156f65b8d7639b10679ec5b Mon Sep 17 00:00:00 2001
From: Russel Arbore <russel.jma@gmail.com>
Date: Thu, 30 Jan 2025 09:56:16 -0600
Subject: [PATCH] remove extern crates

---
 hercules_opt/src/editor.rs                | 11 +++-------
 hercules_opt/src/fork_transforms.rs       | 18 +++++++---------
 hercules_opt/src/forkify.rs               | 14 +++++-------
 hercules_opt/src/ivar.rs                  | 25 ++++++++--------------
 hercules_opt/src/loop_canonicalization.rs | 26 ++++++++++-------------
 hercules_opt/src/utils.rs                 |  2 --
 juno_samples/cava/build.rs                |  1 -
 juno_scheduler/src/compile.rs             |  3 +--
 juno_scheduler/src/ir.rs                  |  4 +---
 juno_utils/src/stringtab.rs               |  4 +---
 10 files changed, 39 insertions(+), 69 deletions(-)

diff --git a/hercules_opt/src/editor.rs b/hercules_opt/src/editor.rs
index 2444fdb4..f6a00c85 100644
--- a/hercules_opt/src/editor.rs
+++ b/hercules_opt/src/editor.rs
@@ -1,18 +1,13 @@
-extern crate bitvec;
-extern crate either;
-extern crate hercules_ir;
-extern crate itertools;
-extern crate nestify;
 use std::borrow::Borrow;
 use std::cell::{Ref, RefCell};
 use std::collections::{BTreeMap, HashMap, HashSet};
 use std::mem::take;
 use std::ops::Deref;
 
-use self::nestify::nest;
+use nestify::nest;
 
-use self::bitvec::prelude::*;
-use self::either::Either;
+use bitvec::prelude::*;
+use either::Either;
 
 use hercules_ir::def_use::*;
 use hercules_ir::ir::*;
diff --git a/hercules_opt/src/fork_transforms.rs b/hercules_opt/src/fork_transforms.rs
index c0196ca0..edf26911 100644
--- a/hercules_opt/src/fork_transforms.rs
+++ b/hercules_opt/src/fork_transforms.rs
@@ -1,25 +1,23 @@
 use std::collections::{HashMap, HashSet};
 use std::ops::Sub;
-extern crate bimap;
-extern crate hercules_ir;
 
 use itertools::Itertools;
 
-use self::bimap::BiMap;
+use bimap::BiMap;
 
-use self::hercules_ir::LoopTree;
+use hercules_ir::LoopTree;
 
-use self::hercules_ir::{Index, TypeID};
+use hercules_ir::{Index, TypeID};
 
-use self::hercules_ir::Subgraph;
+use hercules_ir::Subgraph;
 
-use self::hercules_ir::DynamicConstantID;
+use hercules_ir::DynamicConstantID;
 
-use self::hercules_ir::Node;
+use hercules_ir::Node;
 
-use self::hercules_ir::{get_uses, Function};
+use hercules_ir::{get_uses, Function};
 
-use self::hercules_ir::{NodeID, ID};
+use hercules_ir::{NodeID, ID};
 
 use crate::{DenseNodeMap, FunctionEditor, Loop, SparseNodeMap};
 
diff --git a/hercules_opt/src/forkify.rs b/hercules_opt/src/forkify.rs
index f3ce186e..10a8fe21 100644
--- a/hercules_opt/src/forkify.rs
+++ b/hercules_opt/src/forkify.rs
@@ -1,21 +1,17 @@
-extern crate bitvec;
-extern crate hercules_ir;
-extern crate nestify;
-
 use core::panic;
 use std::collections::HashMap;
 use std::collections::HashSet;
 use std::iter::zip;
 use std::iter::FromIterator;
 
-use self::nestify::nest;
+use nestify::nest;
 
-use self::bitvec::order::Lsb0;
-use self::bitvec::vec::BitVec;
+use bitvec::order::Lsb0;
+use bitvec::vec::BitVec;
 
-use self::hercules_ir::Subgraph;
+use hercules_ir::Subgraph;
 
-use self::hercules_ir::control_subgraph;
+use hercules_ir::control_subgraph;
 
 use crate::calculate_loop_nodes;
 use crate::compute_induction_vars;
diff --git a/hercules_opt/src/ivar.rs b/hercules_opt/src/ivar.rs
index bde3bde3..1f31e220 100644
--- a/hercules_opt/src/ivar.rs
+++ b/hercules_opt/src/ivar.rs
@@ -1,32 +1,25 @@
-extern crate bitvec;
-extern crate hercules_ir;
-extern crate nestify;
-extern crate slotmap;
-
 use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};
 use std::path::Iter;
 
-use self::nestify::nest;
+use nestify::nest;
 
-use self::hercules_ir::Subgraph;
+use hercules_ir::Subgraph;
 
-use self::bitvec::order::Lsb0;
-use self::bitvec::prelude::*;
-use self::bitvec::vec::BitVec;
-use self::hercules_ir::get_uses;
+use bitvec::order::Lsb0;
+use bitvec::prelude::*;
+use bitvec::vec::BitVec;
+use hercules_ir::get_uses;
 
-use self::hercules_ir::LoopTree;
+use hercules_ir::LoopTree;
 
 use crate::walk_all_uses_stop_on;
 
-use self::slotmap::{new_key_type, SlotMap};
+use slotmap::{new_key_type, SlotMap};
 
-use self::hercules_ir::ir::*;
+use hercules_ir::ir::*;
 
 use crate::*;
 
-
-
 #[derive(Debug)]
 pub struct LoopVarianceInfo {
     pub loop_header: NodeID,
diff --git a/hercules_opt/src/loop_canonicalization.rs b/hercules_opt/src/loop_canonicalization.rs
index 64727e70..12d8fd3b 100644
--- a/hercules_opt/src/loop_canonicalization.rs
+++ b/hercules_opt/src/loop_canonicalization.rs
@@ -1,7 +1,3 @@
-extern crate hercules_ir;
-extern crate itertools;
-extern crate nestify;
-
 use std::collections::HashMap;
 use std::collections::HashSet;
 use std::iter::FromIterator;
@@ -9,22 +5,22 @@ use std::iter::FromIterator;
 use hercules_ir::Constant;
 use hercules_ir::TypeID;
 
-use self::nestify::nest;
+use nestify::nest;
 
-use self::hercules_ir::get_uses;
+use hercules_ir::get_uses;
 
-use self::itertools::Itertools;
+use itertools::Itertools;
 
-use self::hercules_ir::BinaryOperator;
+use hercules_ir::BinaryOperator;
 
-use self::hercules_ir::Function;
-use self::hercules_ir::Node;
+use hercules_ir::Function;
+use hercules_ir::Node;
 
-use self::hercules_ir::ID;
+use hercules_ir::ID;
 
-use self::hercules_ir::NodeID;
+use hercules_ir::NodeID;
 
-use self::hercules_ir::Subgraph;
+use hercules_ir::Subgraph;
 
 use crate::calculate_loop_nodes;
 use crate::compute_loop_variance;
@@ -36,7 +32,7 @@ use crate::LoopExit;
 use crate::LoopVariance;
 use crate::LoopVarianceInfo;
 
-use self::hercules_ir::LoopTree;
+use hercules_ir::LoopTree;
 
 /** On return `true` means the function has been modified, and loop_canonicalization can be ran again 
    (with newly analysis info), to canonicalze more loops. */
@@ -900,4 +896,4 @@ pub fn canonicalize_loop_old(
     
     // changed
     false
-}
\ No newline at end of file
+}
diff --git a/hercules_opt/src/utils.rs b/hercules_opt/src/utils.rs
index 67225bff..cc7abc7f 100644
--- a/hercules_opt/src/utils.rs
+++ b/hercules_opt/src/utils.rs
@@ -1,5 +1,3 @@
-extern crate nestify;
-
 use std::collections::HashMap;
 use std::collections::HashSet;
 use std::iter::zip;
diff --git a/juno_samples/cava/build.rs b/juno_samples/cava/build.rs
index 929d3eba..7f60f801 100644
--- a/juno_samples/cava/build.rs
+++ b/juno_samples/cava/build.rs
@@ -1,4 +1,3 @@
-extern crate juno_build;
 use juno_build::JunoCompiler;
 
 fn main() {
diff --git a/juno_scheduler/src/compile.rs b/juno_scheduler/src/compile.rs
index 0b3264ac..14dd828b 100644
--- a/juno_scheduler/src/compile.rs
+++ b/juno_scheduler/src/compile.rs
@@ -4,8 +4,7 @@ use crate::parser;
 use juno_utils::env::Env;
 use juno_utils::stringtab::StringTable;
 
-extern crate hercules_ir;
-use self::hercules_ir::ir::{Device, Schedule};
+use hercules_ir::ir::{Device, Schedule};
 
 use lrlex::DefaultLexerTypes;
 use lrpar::NonStreamingLexer;
diff --git a/juno_scheduler/src/ir.rs b/juno_scheduler/src/ir.rs
index f16279e7..aa9b2367 100644
--- a/juno_scheduler/src/ir.rs
+++ b/juno_scheduler/src/ir.rs
@@ -1,6 +1,4 @@
-extern crate hercules_ir;
-
-use self::hercules_ir::ir::{Device, Schedule};
+use hercules_ir::ir::{Device, Schedule};
 
 #[derive(Debug, Copy, Clone)]
 pub enum Pass {
diff --git a/juno_utils/src/stringtab.rs b/juno_utils/src/stringtab.rs
index e151b830..45ee0864 100644
--- a/juno_utils/src/stringtab.rs
+++ b/juno_utils/src/stringtab.rs
@@ -1,6 +1,4 @@
-extern crate serde;
-
-use self::serde::{Deserialize, Serialize};
+use serde::{Deserialize, Serialize};
 
 use std::collections::HashMap;
 
-- 
GitLab