style: reformat

This commit is contained in:
xeruf 2024-07-31 20:08:33 +03:00
parent 03263840ac
commit afd6f2f77a
3 changed files with 17 additions and 23 deletions

View File

@ -190,8 +190,7 @@ async fn main() {
" {}{}) ", " {}{}) ",
tasks.get_task_path(tasks.get_position()), tasks.get_task_path(tasks.get_position()),
tasks.get_prompt_suffix() tasks.get_prompt_suffix()
) ).italic()
.italic()
); );
stdout().flush().unwrap(); stdout().flush().unwrap();
match lines.next() { match lines.next() {

View File

@ -159,10 +159,7 @@ impl TaskState {
} }
pub(crate) fn matches_label(&self, label: &str) -> bool { pub(crate) fn matches_label(&self, label: &str) -> bool {
self.state == State::Active self.state == State::Active
|| self || self.name.as_ref().is_some_and(|n| n.eq_ignore_ascii_case(label))
.name
.as_ref()
.is_some_and(|n| n.eq_ignore_ascii_case(label))
|| self.state.to_string().eq_ignore_ascii_case(label) || self.state.to_string().eq_ignore_ascii_case(label)
} }
} }

View File

@ -198,8 +198,7 @@ impl Tasks {
self.traverse_up_from(Some(id)) self.traverse_up_from(Some(id))
.take_while(|t| Some(t.event.id) != self.position), .take_while(|t| Some(t.event.id) != self.position),
false, false,
) ).unwrap_or(id.to_string())
.unwrap_or(id.to_string())
} }
// Helpers // Helpers
@ -266,8 +265,7 @@ impl Tasks {
.values() .values()
.filter(|t| t.parent_id() == self.position) .filter(|t| t.parent_id() == self.position)
.map(|t| t.get_id()), .map(|t| t.get_id()),
) ).into_iter()
.into_iter()
.filter(|t| { .filter(|t| {
self.state.as_ref().map_or(true, |state| { self.state.as_ref().map_or(true, |state| {
t.state().is_some_and(|t| t.matches_label(state)) t.state().is_some_and(|t| t.matches_label(state))
@ -373,7 +371,7 @@ impl Tasks {
pub(crate) fn move_to(&mut self, id: Option<EventId>) { pub(crate) fn move_to(&mut self, id: Option<EventId>) {
self.view.clear(); self.view.clear();
self.tags.clear(); self.tags.clear(); // TODO unsure if this is needed, needs alternative way to clear
if id == self.position { if id == self.position {
return; return;
} }