chore: reformat & clippy cleanup (#96)
Some checks failed
Run Check Script / check (pull_request) Has been cancelled
Run Check Script / check (push) Has been cancelled
Compile and package harmony_composer / package_harmony_composer (push) Has been cancelled

Clippy is now added to the `check` in the pipeline

Co-authored-by: Ian Letourneau <letourneau.ian@gmail.com>
Reviewed-on: #96
This commit is contained in:
2025-08-06 15:57:14 +00:00
parent 024084859e
commit 440c1bce12
68 changed files with 342 additions and 350 deletions

View File

@@ -14,9 +14,9 @@ use tokio::sync::mpsc;
#[derive(Debug)]
enum ExecutionState {
INITIATED,
RUNNING,
CANCELED,
Initiated,
Running,
Canceled,
}
struct Execution<T: Topology> {
@@ -62,7 +62,7 @@ impl<T: Topology> ScoreListWidget<T> {
pub(crate) fn launch_execution(&mut self) {
if let Some(score) = self.get_selected_score() {
self.execution = Some(Execution {
state: ExecutionState::INITIATED,
state: ExecutionState::Initiated,
score: score.clone_box(),
});
info!("{}\n\nConfirm Execution (Press y/n)", score.name());
@@ -106,7 +106,7 @@ impl<T: Topology> ScoreListWidget<T> {
if let Some(execution) = &mut self.execution {
match confirm {
true => {
execution.state = ExecutionState::RUNNING;
execution.state = ExecutionState::Running;
info!("Launch execution {execution}");
self.sender
.send(HarmonyTuiEvent::LaunchScore(execution.score.clone_box()))
@@ -114,7 +114,7 @@ impl<T: Topology> ScoreListWidget<T> {
.expect("Should be able to send message");
}
false => {
execution.state = ExecutionState::CANCELED;
execution.state = ExecutionState::Canceled;
info!("Execution cancelled");
self.clear_execution();
}
@@ -144,7 +144,11 @@ impl<T: Topology> Widget for &ScoreListWidget<T> {
Self: Sized,
{
let mut list_state = self.list_state.write().unwrap();
let scores_items: Vec<ListItem<'_>> = self.scores.iter().map(score_to_list_item).collect();
let scores_items: Vec<ListItem<'_>> = self
.scores
.iter()
.map(|score| ListItem::new(score.name()))
.collect();
let list = List::new(scores_items)
.highlight_style(Style::new().bold().italic())
.highlight_symbol("🠊 ");
@@ -152,7 +156,3 @@ impl<T: Topology> Widget for &ScoreListWidget<T> {
StatefulWidget::render(list, area, buf, &mut list_state)
}
}
fn score_to_list_item<'a, T: Topology>(score: &'a Box<dyn Score<T>>) -> ListItem<'a> {
ListItem::new(score.name())
}