Skip to content

Commit

Permalink
fix: clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebedthan committed Jun 18, 2024
1 parent d561854 commit cd9e64b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
8 changes: 2 additions & 6 deletions src/cmd/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ impl SearchResults {
fn get_total_rows(&self) -> u32 {
self.total_rows
}
fn get_rows(&self) -> &[SearchResult] {
&self.rows
}
}

/// Search GTDB's using taxon name with partial match
Expand All @@ -90,7 +87,6 @@ pub fn partial_search(args: utils::SearchArgs) -> Result<()> {
};

let search_result: SearchResults = response.into_json()?;
let search_result_list = search_result.get_rows();
ensure!(
search_result.get_total_rows() != 0,
"No matching data found in GTDB"
Expand Down Expand Up @@ -218,7 +214,7 @@ mod tests {
total_rows: 3,
};
results.filter("Proteobacteria".to_string(), "p".to_string());
assert_eq!(results.get_rows().len(), 2);
assert_eq!(results.rows.len(), 2);
assert_eq!(results.get_total_rows(), 2);
}

Expand Down Expand Up @@ -254,7 +250,7 @@ mod tests {
],
total_rows: 3,
};
assert_eq!(results.get_rows().len(), 3);
assert_eq!(results.rows.len(), 3);
}

#[test]
Expand Down
19 changes: 2 additions & 17 deletions src/cmd/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::{
/// Here the hashmap key will be the taxon name and the hashmap value the rank
pub type Taxa = HashMap<String, String>;

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Default)]
pub struct SearchArgs {
pub(crate) taxa: Taxa,
pub(crate) id: bool,
Expand All @@ -28,21 +28,6 @@ pub struct SearchArgs {
pub(crate) disable_certificate_verification: bool,
}

impl Default for SearchArgs {
fn default() -> Self {
SearchArgs {
taxa: Taxa::new(),
id: false,
count: false,
raw: false,
rep: false,
type_material: false,
out: None,
disable_certificate_verification: false,
}
}
}

impl SearchArgs {
pub fn add_taxon(&mut self, taxon: &str) {
let parts = taxon.split("__").collect::<Vec<&str>>();
Expand Down Expand Up @@ -131,7 +116,7 @@ impl SearchArgs {
search_args.add_taxon(&nline);
}
} else if let Some(name) = args.get_one::<String>("name") {
search_args.add_taxon(&name)
search_args.add_taxon(name)
}

search_args.set_id(args.get_flag("id"));
Expand Down

0 comments on commit cd9e64b

Please sign in to comment.