Skip to content

Commit bddac12

Browse files
committed
style(edition): run cargo --fix edition
Performs some automatic migration to the 2024 edition of Rust. Will be followed by a cleanup commit.
1 parent d54455e commit bddac12

File tree

13 files changed

+47
-47
lines changed

13 files changed

+47
-47
lines changed

src/io/infer_format/dispatch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl<
231231
}
232232

233233
macro_rules! msfmt_dispatch {
234-
($d:ident, $r:ident, $e:expr) => {
234+
($d:ident, $r:ident, $e:expr_2021) => {
235235
match $d {
236236
#[cfg(feature = "mzml")]
237237
MZReaderType::MzML($r) => $e,
@@ -771,7 +771,7 @@ impl<
771771
}
772772

773773
macro_rules! msfmt_dispatch_cap {
774-
($d:ident, $r:ident, $e:expr) => {
774+
($d:ident, $r:ident, $e:expr_2021) => {
775775
match $d {
776776
#[cfg(feature = "mzml")]
777777
MZReaderType::MzML($r) => {
@@ -1351,7 +1351,7 @@ pub enum IMMZReaderType<
13511351
}
13521352

13531353
macro_rules! immsfmt_dispatch {
1354-
($d:ident, $r:ident, $e:expr) => {
1354+
($d:ident, $r:ident, $e:expr_2021) => {
13551355
match $d {
13561356
#[cfg(feature = "mzml")]
13571357
IMMZReaderType::MzML($r) => $e,

src/io/infer_format/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ mod test {
5757
fn infer_open() {
5858
let path = path::Path::new("./test/data/small.mzML");
5959
assert!(path.exists());
60-
if let Ok(mut reader) = MZReader::open_path(path) {
60+
match MZReader::open_path(path) { Ok(mut reader) => {
6161
assert_eq!(reader.len(), 48);
6262
assert_eq!(*reader.detail_level(), DetailLevel::Full);
6363
if let Some(spec) = reader.get_spectrum_by_index(10) {
@@ -87,9 +87,9 @@ mod test {
8787
} else {
8888
panic!("Failed to retrieve spectrum by time")
8989
}
90-
} else {
90+
} _ => {
9191
panic!("Failed to open file")
92-
}
92+
}}
9393
}
9494

9595
#[cfg(feature = "thermo")]

src/io/mzml/reader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ macro_rules! xml_error {
461461
($state:ident, $xml_err:ident) => {
462462
MzMLParserError::XMLError($state, $xml_err)
463463
};
464-
($state:ident, $xml_err:ident, $ctx:expr) => {
464+
($state:ident, $xml_err:ident, $ctx:expr_2021) => {
465465
MzMLParserError::XMLErrorContext($state, $xml_err, $ctx)
466466
};
467467
}

src/io/mzml/writer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ macro_rules! bstart {
4545
}
4646

4747
macro_rules! attrib {
48-
($name:expr, $value:expr, $elt:ident) => {{
48+
($name:expr_2021, $value:expr_2021, $elt:ident) => {{
4949
let key = $name.as_bytes();
5050
let value = $value.as_bytes();
5151
// Because quick_xml::escape does not escape newlines

src/io/shorthand.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,10 @@ impl<C: CentroidPeakAdapting, D: DeconvolutedPeakAdapting> SpectrumWriter<C, D>
391391
/// the closure.
392392
#[macro_export]
393393
macro_rules! mz_read {
394-
($source:expr, $reader:ident => $impl:tt) => {
394+
($source:expr_2021, $reader:ident => $impl:tt) => {
395395
$crate::mz_read!($source, $reader => $impl, $crate::mzpeaks::CentroidPeak, $crate::mzpeaks::DeconvolutedPeak)
396396
};
397-
($source:expr, $reader:ident => $impl:tt, $C:ty, $D:ty) => {{
397+
($source:expr_2021, $reader:ident => $impl:tt, $C:ty, $D:ty) => {{
398398
let source = $crate::io::Source::<_, _>::from($source);
399399
match source {
400400
$crate::io::Source::PathLike(read_path) => {
@@ -574,10 +574,10 @@ macro_rules! mz_read {
574574
/// the closure
575575
#[macro_export]
576576
macro_rules! mz_write {
577-
($sink:expr, $writer:ident => $impl:tt) => {
577+
($sink:expr_2021, $writer:ident => $impl:tt) => {
578578
mz_write!($sink, $writer => $impl, $crate::mzpeaks::CentroidPeak, $crate::mzpeaks::DeconvolutedPeak)
579579
};
580-
($sink:expr, $writer:ident => $impl:tt, $C:ty, $D:ty) => {{
580+
($sink:expr_2021, $writer:ident => $impl:tt, $C:ty, $D:ty) => {{
581581
let sink = $crate::io::Sink::<$C, $D>::from($sink);
582582
match sink {
583583
$crate::io:: Sink::Sender(_) | $crate::io::Sink::SyncSender(_) => {

src/io/traits/frame.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -583,15 +583,15 @@ impl<
583583
{
584584
/// Start iterating from the spectrum whose native ID matches `id`
585585
fn start_from_id(&mut self, id: &str) -> Result<&mut Self, IonMobilityFrameAccessError> {
586-
if let Some(scan) = self.get_frame_by_id(id) {
586+
match self.get_frame_by_id(id) { Some(scan) => {
587587
self.index = scan.index();
588588
self.back_index = 0;
589589
Ok(self)
590-
} else if self.get_index().contains_key(id) {
590+
} _ => if self.get_index().contains_key(id) {
591591
Err(IonMobilityFrameAccessError::IOError(None))
592592
} else {
593593
Err(IonMobilityFrameAccessError::FrameIdNotFound(id.to_string()))
594-
}
594+
}}
595595
}
596596

597597
fn start_from_index(&mut self, index: usize) -> Result<&mut Self, IonMobilityFrameAccessError> {
@@ -605,11 +605,11 @@ impl<
605605
}
606606

607607
fn start_from_time(&mut self, time: f64) -> Result<&mut Self, IonMobilityFrameAccessError> {
608-
if let Some(scan) = self.get_frame_by_time(time) {
608+
match self.get_frame_by_time(time) { Some(scan) => {
609609
self.index = scan.index();
610610
self.back_index = 0;
611611
Ok(self)
612-
} else if self
612+
} _ => if self
613613
.get_frame_by_index(self.len() - 1)
614614
.expect("Failed to fetch spectrum for boundary testing")
615615
.start_time()
@@ -618,7 +618,7 @@ impl<
618618
Err(IonMobilityFrameAccessError::FrameNotFound)
619619
} else {
620620
Err(IonMobilityFrameAccessError::IOError(None))
621-
}
621+
}}
622622
}
623623
}
624624

src/io/traits/spectrum.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -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

src/meta/file_description.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ impl From<&SpectrumType> for crate::params::Param {
950950
}
951951

952952
macro_rules! t {
953-
($t:expr) => {
953+
($t:expr_2021) => {
954954
($t, $t.to_param())
955955
};
956956
}

src/params.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,17 +1206,17 @@ macro_rules! accessioncode {
12061206

12071207
#[macro_export]
12081208
macro_rules! find_param_method {
1209-
($meth:ident, $curie:expr) => {
1209+
($meth:ident, $curie:expr_2021) => {
12101210
$crate::find_param_method!($meth, $curie, "Find a parameter by its CURIE");
12111211
};
1212-
($meth:ident, $curie:expr, $desc:literal) => {
1212+
($meth:ident, $curie:expr_2021, $desc:literal) => {
12131213
#[doc=$desc]
12141214
pub fn $meth(&self) -> Option<$crate::params::ValueRef<'_>> {
12151215
self.get_param_by_curie($curie)
12161216
.map(|p| $crate::params::ParamLike::value(p))
12171217
}
12181218
};
1219-
($meth:ident, $curie:expr, $conv:expr, $result:ty) => {
1219+
($meth:ident, $curie:expr_2021, $conv:expr_2021, $result:ty) => {
12201220
$crate::find_param_method!(
12211221
$meth,
12221222
$curie,
@@ -1225,7 +1225,7 @@ macro_rules! find_param_method {
12251225
"Find a parameter by its CURIE"
12261226
);
12271227
};
1228-
($meth:ident, $curie:expr, $conv:expr, $result:ty, $desc:literal) => {
1228+
($meth:ident, $curie:expr_2021, $conv:expr_2021, $result:ty, $desc:literal) => {
12291229
#[doc=$desc]
12301230
pub fn $meth(&self) -> $result {
12311231
self.get_param_by_curie($curie).map($conv)

src/spectrum/bindata/map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl BinaryArrayMap {
215215
.get(name)
216216
.ok_or_else(|| ArrayRetrievalError::NotFound(name.clone()))?;
217217
macro_rules! sort_mask {
218-
($conv:expr, $cmp:expr) => {{
218+
($conv:expr_2021, $cmp:expr_2021) => {{
219219
let vals = $conv?;
220220
if vals.is_sorted() {
221221
return Ok(());

0 commit comments

Comments
 (0)