From 565e2f77f6c011b5b748cbbfbd717a34a90b7ec8 Mon Sep 17 00:00:00 2001 From: Ethan Holz Date: Fri, 26 Jan 2024 10:37:14 -0600 Subject: [PATCH] fix: added CI updates to pass build --- src/lib.rs | 4 ++-- src/main.rs | 9 +++++---- src/records/atom.rs | 2 +- src/records/mtrixn.rs | 8 ++++---- src/records/seqres.rs | 1 - 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 93bab8f..8049251 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,7 +2,7 @@ pub mod records; use records::Record; #[cfg(feature = "parallel")] -pub fn pdbreader(contents: &String) -> Vec { +pub fn pdbreader(contents: &str) -> Vec { use rayon::prelude::*; let lines: Vec<&str> = contents.lines().collect(); @@ -34,7 +34,7 @@ pub fn pdbreader(contents: &String) -> Vec { record } -pub fn pdbreader_single(contents: &String) -> Vec { +pub fn pdbreader_single(contents: &str) -> Vec { let mut last = 0; contents .lines() diff --git a/src/main.rs b/src/main.rs index b7104c0..d35a39a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,10 +35,11 @@ fn main() { // println!("{:?}", out[0]); out.iter() // .filter(|&record| matches!(record, records::Record::DBRef(_))) - .filter(|&record| match record { - records::Record::DBRef(_) => true, - records::Record::Seqres(_) => true, - _ => false, + .filter(|&record| { + matches!( + record, + records::Record::Seqres(_) | records::Record::DBRef(_) + ) }) // .skip(99996) // .take(10) diff --git a/src/records/atom.rs b/src/records/atom.rs index b7123ae..af868b2 100644 --- a/src/records/atom.rs +++ b/src/records/atom.rs @@ -44,7 +44,7 @@ impl AtomRecord { element: str .get(77..80) .map(|str| str.trim().to_string()) - .filter(|item| item != ""), + .filter(|item| !item.is_empty()), charge: str .get(78..80) .map(|str| str.trim().to_string()) diff --git a/src/records/mtrixn.rs b/src/records/mtrixn.rs index 68ff7d2..be7b77e 100644 --- a/src/records/mtrixn.rs +++ b/src/records/mtrixn.rs @@ -91,7 +91,7 @@ mod tests { assert_eq!(record.serial_number, 1); assert_eq!(record.matrix, [-1., 0., 0.]); assert_eq!(record.vn, 0.); - assert_eq!(record.i_given, true); + assert!(record.i_given); let line2 = "MTRIX2 1 0.000000 1.000000 0.000000 0.00000 1"; let record = MtrixnRecord::from(line2); @@ -99,7 +99,7 @@ mod tests { assert_eq!(record.serial_number, 1); assert_eq!(record.matrix, [0., 1., 0.]); assert_eq!(record.vn, 0.); - assert_eq!(record.i_given, true); + assert!(record.i_given); } #[test] @@ -112,9 +112,9 @@ mod tests { assert_eq!(record.serial_number, 1); assert_eq!(record.matrix, [-1., 0., 0.]); assert_eq!(record.vn, 0.); - assert_eq!(record.i_given, true); + assert!(record.i_given); } - _ => assert!(false), + _ => unreachable!(), } } diff --git a/src/records/seqres.rs b/src/records/seqres.rs index b74d394..1bfa166 100644 --- a/src/records/seqres.rs +++ b/src/records/seqres.rs @@ -17,7 +17,6 @@ impl SeqresRecord { chain_id: str.chars().nth(11).unwrap(), num_res: str[13..17].trim().parse().unwrap(), res_names: str[19..] - .trim() .split_whitespace() .map(|s| s.to_string()) .collect(),