@@ -126,7 +126,7 @@ impl FileRevlogPopup {
126126 || self
127127 . git_history
128128 . as_ref ( )
129- . map_or ( false , AsyncSingleJob :: is_pending)
129+ . is_some_and ( AsyncSingleJob :: is_pending)
130130 }
131131
132132 ///
@@ -145,7 +145,7 @@ impl FileRevlogPopup {
145145 if self . visible {
146146 match event {
147147 AsyncGitNotification :: FileHistory => {
148- self . update_list ( ) ?
148+ self . update_list ( ) ?;
149149 }
150150 AsyncGitNotification :: Diff => self . update_diff ( ) ?,
151151 _ => ( ) ,
@@ -193,8 +193,10 @@ impl FileRevlogPopup {
193193 }
194194
195195 pub fn update_list ( & mut self ) -> Result < ( ) > {
196- if let Some ( progress) =
197- self . git_history . as_ref ( ) . and_then ( |job| job. progress ( ) )
196+ if let Some ( progress) = self
197+ . git_history
198+ . as_ref ( )
199+ . and_then ( asyncgit:: asyncjob:: AsyncSingleJob :: progress)
198200 {
199201 let result = progress. extract_results ( ) ?;
200202
@@ -205,7 +207,7 @@ impl FileRevlogPopup {
205207
206208 let was_empty = self . items . is_empty ( ) ;
207209
208- self . items . extend ( result. into_iter ( ) ) ;
210+ self . items . extend ( result) ;
209211
210212 if was_empty && !self . items . is_empty ( ) {
211213 self . queue
@@ -221,8 +223,7 @@ impl FileRevlogPopup {
221223
222224 let commit_id = table_state. selected ( ) . and_then ( |selected| {
223225 self . items
224- . iter ( )
225- . nth ( selected)
226+ . get ( selected)
226227 . as_ref ( )
227228 . map ( |entry| entry. commit )
228229 } ) ;
@@ -323,10 +324,7 @@ impl FileRevlogPopup {
323324 . collect ( )
324325 }
325326
326- fn move_selection (
327- & mut self ,
328- scroll_type : ScrollType ,
329- ) -> Result < ( ) > {
327+ fn move_selection ( & mut self , scroll_type : ScrollType ) {
330328 let old_selection =
331329 self . table_state . get_mut ( ) . selected ( ) . unwrap_or ( 0 ) ;
332330 let max_selection = self . items . len ( ) . saturating_sub ( 1 ) ;
@@ -353,8 +351,6 @@ impl FileRevlogPopup {
353351 }
354352
355353 self . set_selection ( new_selection) ;
356-
357- Ok ( ( ) )
358354 }
359355
360356 fn set_selection ( & mut self , selection : usize ) {
@@ -416,9 +412,7 @@ impl FileRevlogPopup {
416412 // at index 50. Subtracting the current offset from the selected index
417413 // yields the correct index in `self.items`, in this case 0.
418414 let mut adjusted_table_state = TableState :: default ( )
419- . with_selected (
420- table_state. selected ( ) . map ( |selected| selected) ,
421- )
415+ . with_selected ( table_state. selected ( ) )
422416 . with_offset ( table_state. offset ( ) ) ;
423417
424418 f. render_widget ( Clear , area) ;
@@ -541,36 +535,36 @@ impl Component for FileRevlogPopup {
541535 }
542536 } else if key_match ( key, self . key_config . keys . move_up )
543537 {
544- self . move_selection ( ScrollType :: Up ) ? ;
538+ self . move_selection ( ScrollType :: Up ) ;
545539 } else if key_match (
546540 key,
547541 self . key_config . keys . move_down ,
548542 ) {
549- self . move_selection ( ScrollType :: Down ) ? ;
543+ self . move_selection ( ScrollType :: Down ) ;
550544 } else if key_match (
551545 key,
552546 self . key_config . keys . shift_up ,
553547 ) || key_match (
554548 key,
555549 self . key_config . keys . home ,
556550 ) {
557- self . move_selection ( ScrollType :: Home ) ? ;
551+ self . move_selection ( ScrollType :: Home ) ;
558552 } else if key_match (
559553 key,
560554 self . key_config . keys . shift_down ,
561555 ) || key_match (
562556 key,
563557 self . key_config . keys . end ,
564558 ) {
565- self . move_selection ( ScrollType :: End ) ? ;
559+ self . move_selection ( ScrollType :: End ) ;
566560 } else if key_match ( key, self . key_config . keys . page_up )
567561 {
568- self . move_selection ( ScrollType :: PageUp ) ? ;
562+ self . move_selection ( ScrollType :: PageUp ) ;
569563 } else if key_match (
570564 key,
571565 self . key_config . keys . page_down ,
572566 ) {
573- self . move_selection ( ScrollType :: PageDown ) ? ;
567+ self . move_selection ( ScrollType :: PageDown ) ;
574568 }
575569 }
576570
0 commit comments