Skip to content

Commit 351d922

Browse files
committed
sim-ln/style: Fix formatting issues
1 parent 442b598 commit 351d922

File tree

5 files changed

+14
-18
lines changed

5 files changed

+14
-18
lines changed

sim-cli/src/parsing.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,18 +168,23 @@ pub async fn create_simulation(cli: &Cli) -> Result<Simulation, anyhow::Error> {
168168
// We need to be able to look up destination nodes in the graph, because we allow defined activities to send to
169169
// nodes that we do not control. To do this, we can just grab the first node in our map and perform the lookup.
170170
let graph = match clients.values().next() {
171-
Some(client) => client.lock().await.get_graph().await
171+
Some(client) => client
172+
.lock()
173+
.await
174+
.get_graph()
175+
.await
172176
.map_err(|e| LightningError::GetGraphError(format!("Error getting graph {:?}", e))),
173177
None => Err(LightningError::GetGraphError("Graph is empty".to_string())),
174178
}?;
175179

176180
let (pk_node_map, alias_node_map) = add_node_to_maps(&clients_info).await?;
177181

178182
let mut graph_nodes_by_alias: HashMap<String, Vec<NodeInfo>> = HashMap::new();
183+
179184
for node in &graph.nodes_by_pk {
180185
graph_nodes_by_alias
181186
.entry(node.1.alias.clone())
182-
.or_insert_with(Vec::new)
187+
.or_default()
183188
.push(node.1.clone());
184189
}
185190

@@ -190,8 +195,7 @@ pub async fn create_simulation(cli: &Cli) -> Result<Simulation, anyhow::Error> {
190195
graph_nodes_by_alias,
191196
};
192197

193-
let validated_activities =
194-
validate_activities(activity, activity_validation_params).await?;
198+
let validated_activities = validate_activities(activity, activity_validation_params).await?;
195199
let tasks = TaskTracker::new();
196200

197201
Ok(Simulation::new(cfg, clients, validated_activities, tasks))
@@ -281,7 +285,7 @@ async fn validate_activities(
281285
pk_node_map,
282286
alias_node_map,
283287
graph_nodes_by_pk,
284-
graph_nodes_by_alias
288+
graph_nodes_by_alias,
285289
} = activity_validation_params;
286290

287291
// Make all the activities identifiable by PK internally
@@ -327,7 +331,7 @@ async fn validate_activities(
327331
NodeId::PublicKey(pk) => {
328332
if let Some(node_info) = pk_node_map.get(pk) {
329333
node_info.clone()
330-
} else if let Some(node_info) = graph_nodes_by_pk.get(pk){
334+
} else if let Some(node_info) = graph_nodes_by_pk.get(pk) {
331335
node_info.clone()
332336
} else {
333337
return Err(LightningError::ValidationError(format!(

simln-lib/src/cln.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ impl LightningNode for ClnNode {
292292
);
293293
}
294294

295-
Ok(Graph {
296-
nodes_by_pk,
297-
})
295+
Ok(Graph { nodes_by_pk })
298296
}
299297
}
300298

simln-lib/src/eclair.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ impl LightningNode for EclairNode {
265265
);
266266
}
267267

268-
Ok(Graph {
269-
nodes_by_pk,
270-
})
268+
Ok(Graph { nodes_by_pk })
271269
}
272270
}
273271

simln-lib/src/lnd.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,7 @@ impl LightningNode for LndNode {
304304
);
305305
}
306306

307-
Ok(Graph {
308-
nodes_by_pk,
309-
})
307+
Ok(Graph { nodes_by_pk })
310308
}
311309
}
312310

simln-lib/src/sim_node.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,9 +660,7 @@ impl<T: SimNetwork> LightningNode for SimNode<'_, T> {
660660
);
661661
}
662662

663-
Ok(Graph {
664-
nodes_by_pk,
665-
})
663+
Ok(Graph { nodes_by_pk })
666664
}
667665
}
668666

0 commit comments

Comments
 (0)