passes clippy lints and removed extra code from the merge

This commit is contained in:
Adhyan 2024-09-03 15:10:44 -06:00
parent e9879eac91
commit f463cf8662

View file

@ -352,19 +352,18 @@ impl<'a> ListState<'a> {
self.message.push_str(&self.search_query);
self.message.push('|');
if self.search_query.is_empty() { return; }
if self.search_query.is_empty() {
return;
}
let idx = self
.app_state
.exercises()
.iter()
.filter_map(|exercise| {
match self.filter() {
Filter::None => Some(exercise),
Filter::Done if exercise.done => Some(exercise),
Filter::Pending if !exercise.done => Some(exercise),
_ => None,
}
.filter(|exercise| match self.filter() {
Filter::None => true,
Filter::Done => exercise.done,
Filter::Pending => !exercise.done,
})
.position(|exercise| exercise.name.contains(self.search_query.as_str()));
@ -377,17 +376,6 @@ impl<'a> ListState<'a> {
self.message.push_str(&msg);
}
}
match idx {
Some(x) => {
let exercise_ind = x;
self.scroll_state.set_selected(exercise_ind);
}
None => {
let msg = String::from(" (not found)");
self.message.push_str(&msg);
}
}
}
// Return `true` if there was something to select.