mirror of
https://github.com/notohh/rustlings.git
synced 2024-12-18 06:58:10 -05:00
passes clippy lints and removed extra code from the merge
This commit is contained in:
parent
e9879eac91
commit
f463cf8662
1 changed files with 12 additions and 24 deletions
|
@ -352,21 +352,20 @@ impl<'a> ListState<'a> {
|
||||||
self.message.push_str(&self.search_query);
|
self.message.push_str(&self.search_query);
|
||||||
self.message.push('|');
|
self.message.push('|');
|
||||||
|
|
||||||
if self.search_query.is_empty() { return; }
|
if self.search_query.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let idx = self
|
let idx = self
|
||||||
.app_state
|
.app_state
|
||||||
.exercises()
|
.exercises()
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|exercise| {
|
.filter(|exercise| match self.filter() {
|
||||||
match self.filter() {
|
Filter::None => true,
|
||||||
Filter::None => Some(exercise),
|
Filter::Done => exercise.done,
|
||||||
Filter::Done if exercise.done => Some(exercise),
|
Filter::Pending => !exercise.done,
|
||||||
Filter::Pending if !exercise.done => Some(exercise),
|
})
|
||||||
_ => None,
|
.position(|exercise| exercise.name.contains(self.search_query.as_str()));
|
||||||
}
|
|
||||||
})
|
|
||||||
.position(|exercise| exercise.name.contains(self.search_query.as_str()));
|
|
||||||
|
|
||||||
match idx {
|
match idx {
|
||||||
Some(exercise_ind) => {
|
Some(exercise_ind) => {
|
||||||
|
@ -377,17 +376,6 @@ impl<'a> ListState<'a> {
|
||||||
self.message.push_str(&msg);
|
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.
|
// Return `true` if there was something to select.
|
||||||
|
|
Loading…
Reference in a new issue