From 28af652793f5a1a366f1f04a0d790806a4300a7a Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 21 Dec 2019 10:54:15 -0500 Subject: Drop petgraph dependency from bootstrap It was essentially unused, likely leftover from a previous refactoring iteration. --- src/bootstrap/Cargo.toml | 1 - src/bootstrap/builder.rs | 47 +---------------------------------------------- 2 files changed, 1 insertion(+), 47 deletions(-) (limited to 'src') diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index c27c318f5ad..7be16cf3f17 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -47,7 +47,6 @@ serde_json = "1.0.2" toml = "0.5" lazy_static = "1.3.0" time = "0.1" -petgraph = "0.4.13" [dev-dependencies] pretty_assertions = "0.5" diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 8b0ad169cfc..2093a49c6f9 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1,7 +1,6 @@ use std::any::Any; use std::cell::{Cell, RefCell}; use std::collections::BTreeSet; -use std::collections::HashMap; use std::env; use std::ffi::OsStr; use std::fmt::Debug; @@ -29,9 +28,6 @@ use crate::{Build, DocTests, Mode, GitRepo}; pub use crate::Compiler; -use petgraph::graph::NodeIndex; -use petgraph::Graph; - pub struct Builder<'a> { pub build: &'a Build, pub top_stage: u32, @@ -40,9 +36,6 @@ pub struct Builder<'a> { stack: RefCell>>, time_spent_on_dependencies: Cell, pub paths: Vec, - graph_nodes: RefCell>, - graph: RefCell>, - parent: Cell>, } impl<'a> Deref for Builder<'a> { @@ -490,9 +483,6 @@ impl<'a> Builder<'a> { stack: RefCell::new(Vec::new()), time_spent_on_dependencies: Cell::new(Duration::new(0, 0)), paths: vec![], - graph_nodes: RefCell::new(HashMap::new()), - graph: RefCell::new(Graph::new()), - parent: Cell::new(None), }; let builder = &builder; @@ -535,17 +525,13 @@ impl<'a> Builder<'a> { stack: RefCell::new(Vec::new()), time_spent_on_dependencies: Cell::new(Duration::new(0, 0)), paths: paths.to_owned(), - graph_nodes: RefCell::new(HashMap::new()), - graph: RefCell::new(Graph::new()), - parent: Cell::new(None), }; builder } - pub fn execute_cli(&self) -> Graph { + pub fn execute_cli(&self) { self.run_step_descriptions(&Builder::get_step_descriptions(self.kind), &self.paths); - self.graph.borrow().clone() } pub fn default_doc(&self, paths: Option<&[PathBuf]>) { @@ -1260,41 +1246,12 @@ impl<'a> Builder<'a> { if let Some(out) = self.cache.get(&step) { self.verbose(&format!("{}c {:?}", " ".repeat(stack.len()), step)); - { - let mut graph = self.graph.borrow_mut(); - let parent = self.parent.get(); - let us = *self - .graph_nodes - .borrow_mut() - .entry(format!("{:?}", step)) - .or_insert_with(|| graph.add_node(format!("{:?}", step))); - if let Some(parent) = parent { - graph.add_edge(parent, us, false); - } - } - return out; } self.verbose(&format!("{}> {:?}", " ".repeat(stack.len()), step)); stack.push(Box::new(step.clone())); } - let prev_parent = self.parent.get(); - - { - let mut graph = self.graph.borrow_mut(); - let parent = self.parent.get(); - let us = *self - .graph_nodes - .borrow_mut() - .entry(format!("{:?}", step)) - .or_insert_with(|| graph.add_node(format!("{:?}", step))); - self.parent.set(Some(us)); - if let Some(parent) = parent { - graph.add_edge(parent, us, true); - } - } - let (out, dur) = { let start = Instant::now(); let zero = Duration::new(0, 0); @@ -1305,8 +1262,6 @@ impl<'a> Builder<'a> { (out, dur - deps) }; - self.parent.set(prev_parent); - if self.config.print_step_timings && dur > Duration::from_millis(100) { println!( "[TIMING] {:?} -- {}.{:03}", -- cgit 1.4.1-3-g733a5