From f6177f85fe5cd76dd46190b10766bb2510b3b1fd Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Tue, 27 Dec 2022 17:30:06 +0100 Subject: [PATCH] cob: Remove redundant type Signed-off-by: Alexis Sellier --- radicle-cob/src/history.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/radicle-cob/src/history.rs b/radicle-cob/src/history.rs index b7bcd331..04cb92d6 100644 --- a/radicle-cob/src/history.rs +++ b/radicle-cob/src/history.rs @@ -60,8 +60,8 @@ impl History { }; let mut entries = HashMap::new(); entries.insert(id, EntryWithClock::from(root_entry)); - let NewGraph { graph, indices } = create_petgraph(&id, &entries); - Self { graph, indices } + + create_petgraph(&id, &entries) } pub fn new(root: Id, entries: HashMap) -> Result @@ -72,8 +72,7 @@ impl History { if !entries.contains_key(&root) { Err(CreateError::MissingRoot) } else { - let NewGraph { graph, indices } = create_petgraph(&root, &entries); - Ok(Self { graph, indices }) + Ok(create_petgraph(&root, &entries)) } } @@ -160,15 +159,10 @@ impl History { } } -struct NewGraph { - graph: petgraph::Graph, - indices: HashMap>, -} - fn create_petgraph<'a>( root: &'a EntryId, entries: &'a HashMap, -) -> NewGraph { +) -> History { let mut graph = petgraph::Graph::new(); let mut indices = HashMap::>::new(); let root = entries.get(root).unwrap().clone(); @@ -185,5 +179,5 @@ fn create_petgraph<'a>( to_process.push(child.clone()); } } - NewGraph { graph, indices } + History { graph, indices } }