Skip to content

Commit eb491d9

Browse files
committed
refactor
1 parent 67b2f63 commit eb491d9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/dfx/src/lib/builders/motoko.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,15 @@ impl CanisterBuilder for MotokoBuilder {
106106
let motoko_info = info.as_info::<MotokoCanisterInfo>()?;
107107
get_imports(self.cache.as_ref(), &motoko_info, &mut *pool.imports.borrow_mut(), pool)?;
108108

109-
// let iter = Bfs::new(pool.imports.borrow().graph);
109+
let graph = &pool.imports.borrow().graph;
110110
match petgraph::algo::toposort(&pool.imports.borrow().graph, None) {
111111
Ok(order) => {
112-
let graph = &pool.imports.borrow().graph;
113112
Ok(order.into_iter().filter_map(|id| match graph.node_weight(id) {
114113
Some(MotokoImport::Canister(name)) => pool.get_first_canister_with_name(name.as_str()), // TODO: a little inefficient
115114
_ => None,
116115
}).map(|canister| canister.canister_id()).collect())
117116
}
118117
Err(err) => {
119-
let graph = &pool.imports.borrow().graph;
120118
let message = match graph.node_weight(err.node_id()) {
121119
Some(canister_id) => match canister_id {
122120
MotokoImport::Canister(name) => name.clone(), // TODO: Can deal without `clone()`?

0 commit comments

Comments
 (0)