@@ -126,7 +126,7 @@ impl FileRevlogPopup {
126
126
|| self
127
127
. git_history
128
128
. as_ref ( )
129
- . map_or ( false , AsyncSingleJob :: is_pending)
129
+ . is_some_and ( AsyncSingleJob :: is_pending)
130
130
}
131
131
132
132
///
@@ -145,7 +145,7 @@ impl FileRevlogPopup {
145
145
if self . visible {
146
146
match event {
147
147
AsyncGitNotification :: FileHistory => {
148
- self . update_list ( ) ?
148
+ self . update_list ( ) ?;
149
149
}
150
150
AsyncGitNotification :: Diff => self . update_diff ( ) ?,
151
151
_ => ( ) ,
@@ -193,8 +193,10 @@ impl FileRevlogPopup {
193
193
}
194
194
195
195
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)
198
200
{
199
201
let result = progress. extract_results ( ) ?;
200
202
@@ -205,7 +207,7 @@ impl FileRevlogPopup {
205
207
206
208
let was_empty = self . items . is_empty ( ) ;
207
209
208
- self . items . extend ( result. into_iter ( ) ) ;
210
+ self . items . extend ( result) ;
209
211
210
212
if was_empty && !self . items . is_empty ( ) {
211
213
self . queue
@@ -221,8 +223,7 @@ impl FileRevlogPopup {
221
223
222
224
let commit_id = table_state. selected ( ) . and_then ( |selected| {
223
225
self . items
224
- . iter ( )
225
- . nth ( selected)
226
+ . get ( selected)
226
227
. as_ref ( )
227
228
. map ( |entry| entry. commit )
228
229
} ) ;
@@ -323,10 +324,7 @@ impl FileRevlogPopup {
323
324
. collect ( )
324
325
}
325
326
326
- fn move_selection (
327
- & mut self ,
328
- scroll_type : ScrollType ,
329
- ) -> Result < ( ) > {
327
+ fn move_selection ( & mut self , scroll_type : ScrollType ) {
330
328
let old_selection =
331
329
self . table_state . get_mut ( ) . selected ( ) . unwrap_or ( 0 ) ;
332
330
let max_selection = self . items . len ( ) . saturating_sub ( 1 ) ;
@@ -353,8 +351,6 @@ impl FileRevlogPopup {
353
351
}
354
352
355
353
self . set_selection ( new_selection) ;
356
-
357
- Ok ( ( ) )
358
354
}
359
355
360
356
fn set_selection ( & mut self , selection : usize ) {
@@ -416,9 +412,7 @@ impl FileRevlogPopup {
416
412
// at index 50. Subtracting the current offset from the selected index
417
413
// yields the correct index in `self.items`, in this case 0.
418
414
let mut adjusted_table_state = TableState :: default ( )
419
- . with_selected (
420
- table_state. selected ( ) . map ( |selected| selected) ,
421
- )
415
+ . with_selected ( table_state. selected ( ) )
422
416
. with_offset ( table_state. offset ( ) ) ;
423
417
424
418
f. render_widget ( Clear , area) ;
@@ -541,36 +535,36 @@ impl Component for FileRevlogPopup {
541
535
}
542
536
} else if key_match ( key, self . key_config . keys . move_up )
543
537
{
544
- self . move_selection ( ScrollType :: Up ) ? ;
538
+ self . move_selection ( ScrollType :: Up ) ;
545
539
} else if key_match (
546
540
key,
547
541
self . key_config . keys . move_down ,
548
542
) {
549
- self . move_selection ( ScrollType :: Down ) ? ;
543
+ self . move_selection ( ScrollType :: Down ) ;
550
544
} else if key_match (
551
545
key,
552
546
self . key_config . keys . shift_up ,
553
547
) || key_match (
554
548
key,
555
549
self . key_config . keys . home ,
556
550
) {
557
- self . move_selection ( ScrollType :: Home ) ? ;
551
+ self . move_selection ( ScrollType :: Home ) ;
558
552
} else if key_match (
559
553
key,
560
554
self . key_config . keys . shift_down ,
561
555
) || key_match (
562
556
key,
563
557
self . key_config . keys . end ,
564
558
) {
565
- self . move_selection ( ScrollType :: End ) ? ;
559
+ self . move_selection ( ScrollType :: End ) ;
566
560
} else if key_match ( key, self . key_config . keys . page_up )
567
561
{
568
- self . move_selection ( ScrollType :: PageUp ) ? ;
562
+ self . move_selection ( ScrollType :: PageUp ) ;
569
563
} else if key_match (
570
564
key,
571
565
self . key_config . keys . page_down ,
572
566
) {
573
- self . move_selection ( ScrollType :: PageDown ) ? ;
567
+ self . move_selection ( ScrollType :: PageDown ) ;
574
568
}
575
569
}
576
570
0 commit comments