Skip to content

Commit d7b75c6

Browse files
committed
commands/normalize: Add conversion from io::Error to NormalizeError
1 parent 15b477f commit d7b75c6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/commands/normalize.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{
1717
#[derive(Debug, Error)]
1818
pub enum NormalizeError {
1919
#[error("I/O error")]
20-
Io(#[source] io::Error),
20+
Io(#[from] io::Error),
2121
#[error("could not open file: {1}")]
2222
OpenFile(#[source] io::Error, PathBuf),
2323
#[error("invalid counts")]
@@ -58,7 +58,7 @@ where
5858

5959
info!(normalization_method = ?method, "normalizing counts");
6060

61-
let lengths = calculate_feature_lengths(&features, &names).map_err(NormalizeError::Io)?;
61+
let lengths = calculate_feature_lengths(&features, &names)?;
6262

6363
let normalized_counts = match method {
6464
normalization::Method::Fpkm => fpkm::normalize(&lengths, &counts),
@@ -68,7 +68,7 @@ where
6868
let stdout = io::stdout().lock();
6969
let mut writer = BufWriter::new(stdout);
7070

71-
write_normalized_counts(&mut writer, &names, &normalized_counts).map_err(NormalizeError::Io)?;
71+
write_normalized_counts(&mut writer, &names, &normalized_counts)?;
7272

7373
Ok(())
7474
}

0 commit comments

Comments
 (0)