Skip to content

Commit

Permalink
fastq2comp: clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kartva committed Dec 20, 2023
1 parent fbf5b63 commit 8163469
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 28 deletions.
1 change: 1 addition & 0 deletions fastq2comp/src/extract_comp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ pub struct Output {
}

/// Takes in reader (for FASTQ lines) and SampleArgs, returns [`BaseComp`]
/// Expects file to be non-empty.
pub fn run<T>(fastq_reader: FASTQReader<T>) -> BaseComp
where
T: BufRead,
Expand Down
32 changes: 15 additions & 17 deletions fastq2comp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,21 @@ impl BaseCompCol {
N: apply(self.N),
}
}

pub fn extract(&mut self, s: &u8) {
match s {
b'A' => self.A += 1,
b'T' => self.T += 1,
b'G' => self.G += 1,
b'C' => self.C += 1,
b'N' => self.N += 1,
_ => panic!(
"Invalid character {:?} == {:?} found in read",
*s as char,
s.to_ascii_lowercase()
),
}
}
}

impl Default for BaseCompCol {
Expand Down Expand Up @@ -257,20 +272,3 @@ mod col_base_comp_tests {
assert_eq!(read.N, 20, "Testing N");
}
}

impl BaseCompCol {
pub fn extract(&mut self, s: &u8) {
match s {
b'A' => self.A += 1,
b'T' => self.T += 1,
b'G' => self.G += 1,
b'C' => self.C += 1,
b'N' => self.N += 1,
_ => panic!(
"Invalid character {:?} == {:?} found in read",
*s as char,
s.to_ascii_lowercase()
),
}
}
}
12 changes: 1 addition & 11 deletions server/src/tempdir.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use log::{debug, log_enabled, trace};
use std::ops::Deref;
use std::{
path::{Path, PathBuf},
path::PathBuf,
process::Command,
};

Expand Down Expand Up @@ -33,16 +33,6 @@ impl TempDir {
cleanup: true,
}
}

/// Create a new TempDir from an existing path.
/// Will not delete the directory on drop.
pub fn from_dir(path: &Path) -> Self {
let path = path.to_path_buf();
Self {
path,
cleanup: false,
}
}
}

impl Deref for TempDir {
Expand Down

0 comments on commit 8163469

Please sign in to comment.