@@ -476,15 +476,15 @@ impl<
476
476
{
477
477
/// Start iterating from the spectrum whose native ID matches `id`
478
478
fn start_from_id ( & mut self , id : & str ) -> Result < & mut Self , SpectrumAccessError > {
479
- if let Some ( scan) = self . get_spectrum_by_id ( id ) {
479
+ match self . get_spectrum_by_id ( id ) { Some ( scan) => {
480
480
self . index = scan. index ( ) ;
481
481
self . back_index = 0 ;
482
482
Ok ( self )
483
- } else if self . get_index ( ) . contains_key ( id) {
483
+ } _ => if self . get_index ( ) . contains_key ( id) {
484
484
Err ( SpectrumAccessError :: IOError ( None ) )
485
485
} else {
486
486
Err ( SpectrumAccessError :: SpectrumIdNotFound ( id. to_string ( ) ) )
487
- }
487
+ } }
488
488
}
489
489
490
490
fn start_from_index ( & mut self , index : usize ) -> Result < & mut Self , SpectrumAccessError > {
@@ -498,11 +498,11 @@ impl<
498
498
}
499
499
500
500
fn start_from_time ( & mut self , time : f64 ) -> Result < & mut Self , SpectrumAccessError > {
501
- if let Some ( scan) = self . get_spectrum_by_time ( time ) {
501
+ match self . get_spectrum_by_time ( time ) { Some ( scan) => {
502
502
self . index = scan. index ( ) ;
503
503
self . back_index = 0 ;
504
504
Ok ( self )
505
- } else if self
505
+ } _ => if self
506
506
. get_spectrum_by_index ( self . len ( ) - 1 )
507
507
. expect ( "Failed to fetch spectrum for boundary testing" )
508
508
. start_time ( )
@@ -511,7 +511,7 @@ impl<
511
511
Err ( SpectrumAccessError :: SpectrumNotFound )
512
512
} else {
513
513
Err ( SpectrumAccessError :: IOError ( None ) )
514
- }
514
+ } }
515
515
}
516
516
}
517
517
@@ -755,11 +755,11 @@ impl<
755
755
/// Fill the buffer with at most `size` spectra
756
756
pub fn populate_buffer ( & mut self , size : usize ) {
757
757
for _ in 0 ..size {
758
- if let Some ( value ) = self . source . next ( ) {
758
+ match self . source . next ( ) { Some ( value ) => {
759
759
self . buffer . push_back ( value) ;
760
- } else {
760
+ } _ => {
761
761
break ;
762
- }
762
+ } }
763
763
}
764
764
}
765
765
}
@@ -1058,12 +1058,12 @@ impl<C: CentroidLike, D: DeconvolutedCentroidLike, S: SpectrumLike<C, D> + Clone
1058
1058
}
1059
1059
1060
1060
fn start_from_time ( & mut self , time : f64 ) -> Result < & mut Self , SpectrumAccessError > {
1061
- if let Some ( scan) = self . get_spectrum_by_time ( time ) {
1061
+ match self . get_spectrum_by_time ( time ) { Some ( scan) => {
1062
1062
self . position = scan. index ( ) ;
1063
1063
Ok ( self )
1064
- } else {
1064
+ } _ => {
1065
1065
Err ( SpectrumAccessError :: SpectrumNotFound )
1066
- }
1066
+ } }
1067
1067
}
1068
1068
}
1069
1069
0 commit comments