1
0
mirror of https://github.com/pcvolkmer/fastq-tools.git synced 2025-09-13 05:02:53 +00:00

refactor: remove path prefix

This commit is contained in:
2025-09-11 21:00:16 +02:00
parent c424f0f191
commit abd587d50f

View File

@@ -1,6 +1,6 @@
use crate::fastq::{Header, Pair}; use crate::fastq::{Header, Pair};
use crate::input_reader; use crate::input_reader;
use crate::metadata_file::MetadataError::{CannotReadFile, ReadError}; use crate::metadata_file::MetadataError::{CannotReadFile, ReadError, UnsupportedFile};
use itertools::Itertools; use itertools::Itertools;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256}; use sha2::{Digest, Sha256};
@@ -96,9 +96,9 @@ impl Display for MetadataError {
f, f,
"{}", "{}",
match self { match self {
MetadataError::CannotReadFile => "Cannot read file".into(), CannotReadFile => "Cannot read file".into(),
MetadataError::UnsupportedFile => "Unsupported file type".into(), UnsupportedFile => "Unsupported file type".into(),
MetadataError::ReadError(err) => format!("Error reading file: {}", err), ReadError(err) => format!("Error reading file: {}", err),
} }
) )
} }
@@ -110,7 +110,7 @@ impl MetadataFile {
pub fn read_file(path: PathBuf, decompress: bool) -> Result<MetadataFile, MetadataError> { pub fn read_file(path: PathBuf, decompress: bool) -> Result<MetadataFile, MetadataError> {
let path = match path.to_str() { let path = match path.to_str() {
Some(path) => path, Some(path) => path,
None => return Err(MetadataError::CannotReadFile), None => return Err(CannotReadFile),
}; };
let file = File::open(path).map_err(|_| CannotReadFile)?; let file = File::open(path).map_err(|_| CannotReadFile)?;
@@ -126,7 +126,7 @@ impl MetadataFile {
{ {
FileType::Fastq FileType::Fastq
} else { } else {
return Err(MetadataError::UnsupportedFile); return Err(UnsupportedFile);
}; };
let file_checksum = match fs::read(path) { let file_checksum = match fs::read(path) {