@@ -476,15 +476,15 @@ impl<
476476{
477477 /// Start iterating from the spectrum whose native ID matches `id`
478478 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) => {
480480 self . index = scan. index ( ) ;
481481 self . back_index = 0 ;
482482 Ok ( self )
483- } else if self . get_index ( ) . contains_key ( id) {
483+ } _ => if self . get_index ( ) . contains_key ( id) {
484484 Err ( SpectrumAccessError :: IOError ( None ) )
485485 } else {
486486 Err ( SpectrumAccessError :: SpectrumIdNotFound ( id. to_string ( ) ) )
487- }
487+ } }
488488 }
489489
490490 fn start_from_index ( & mut self , index : usize ) -> Result < & mut Self , SpectrumAccessError > {
@@ -498,11 +498,11 @@ impl<
498498 }
499499
500500 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) => {
502502 self . index = scan. index ( ) ;
503503 self . back_index = 0 ;
504504 Ok ( self )
505- } else if self
505+ } _ => if self
506506 . get_spectrum_by_index ( self . len ( ) - 1 )
507507 . expect ( "Failed to fetch spectrum for boundary testing" )
508508 . start_time ( )
@@ -511,7 +511,7 @@ impl<
511511 Err ( SpectrumAccessError :: SpectrumNotFound )
512512 } else {
513513 Err ( SpectrumAccessError :: IOError ( None ) )
514- }
514+ } }
515515 }
516516}
517517
@@ -755,11 +755,11 @@ impl<
755755 /// Fill the buffer with at most `size` spectra
756756 pub fn populate_buffer ( & mut self , size : usize ) {
757757 for _ in 0 ..size {
758- if let Some ( value ) = self . source . next ( ) {
758+ match self . source . next ( ) { Some ( value ) => {
759759 self . buffer . push_back ( value) ;
760- } else {
760+ } _ => {
761761 break ;
762- }
762+ } }
763763 }
764764 }
765765}
@@ -1058,12 +1058,12 @@ impl<C: CentroidLike, D: DeconvolutedCentroidLike, S: SpectrumLike<C, D> + Clone
10581058 }
10591059
10601060 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) => {
10621062 self . position = scan. index ( ) ;
10631063 Ok ( self )
1064- } else {
1064+ } _ => {
10651065 Err ( SpectrumAccessError :: SpectrumNotFound )
1066- }
1066+ } }
10671067 }
10681068}
10691069
0 commit comments