@@ -636,17 +636,11 @@ impl Pager {
636
636
None => {
637
637
// Handle the case of nothing selected yet.
638
638
match direction {
639
- SelectionMotion :: South
640
- | SelectionMotion :: PageSouth
641
- | SelectionMotion :: Next
642
- | SelectionMotion :: North
643
- | SelectionMotion :: Prev => {
644
- // These directions do something sane.
645
- if matches ! ( direction, SelectionMotion :: Prev | SelectionMotion :: North ) {
646
- self . selected_completion_idx = Some ( self . completion_infos . len ( ) - 1 ) ;
647
- } else {
648
- self . selected_completion_idx = Some ( 0 ) ;
649
- }
639
+ SelectionMotion :: South | SelectionMotion :: PageSouth | SelectionMotion :: Next => {
640
+ self . selected_completion_idx = Some ( 0 )
641
+ }
642
+ SelectionMotion :: North | SelectionMotion :: Prev => {
643
+ self . selected_completion_idx = Some ( self . completion_infos . len ( ) - 1 )
650
644
}
651
645
SelectionMotion :: East
652
646
| SelectionMotion :: West
@@ -967,10 +961,9 @@ impl Pager {
967
961
// Updates the completions list per the filter.
968
962
pub fn refilter_completions ( & mut self ) {
969
963
self . completion_infos . clear ( ) ;
970
- for i in 0 ..self . unfiltered_completion_infos . len ( ) {
971
- if self . completion_info_passes_filter ( & self . unfiltered_completion_infos [ i] ) {
972
- self . completion_infos
973
- . push ( self . unfiltered_completion_infos [ i] . clone ( ) ) ;
964
+ for comp in & self . unfiltered_completion_infos {
965
+ if self . completion_info_passes_filter ( comp) {
966
+ self . completion_infos . push ( comp. clone ( ) ) ;
974
967
}
975
968
}
976
969
}
0 commit comments