chore: reformat & clippy cleanup (#96)
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:
@@ -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())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user