Remove unnecessary trimming and lowercasing

This commit is contained in:
blank X 2021-02-10 18:27:12 +07:00
parent 6c2e981509
commit 0eb544a3e6
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
4 changed files with 4 additions and 4 deletions

2
Cargo.lock generated
View File

@ -202,7 +202,7 @@ dependencies = [
[[package]] [[package]]
name = "hanimers" name = "hanimers"
version = "0.1.4" version = "0.1.5"
dependencies = [ dependencies = [
"clap", "clap",
"quick-xml", "quick-xml",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "hanimers" name = "hanimers"
version = "0.1.4" version = "0.1.5"
authors = ["blank X <theblankx@protonmail.com>"] authors = ["blank X <theblankx@protonmail.com>"]
edition = "2018" edition = "2018"

View File

@ -8,7 +8,7 @@ pub const AVALIABLE_TAGS: &[&str] = &["3D", "Ahegao", "Anal", "BDSM", "Big Boobs
pub async fn search(arg_m: &ArgMatches<'_>) { pub async fn search(arg_m: &ArgMatches<'_>) {
let broad_search = arg_m.is_present("broad"); let broad_search = arg_m.is_present("broad");
let tags = arg_m.values_of("tags").unwrap_or_default().map(|i| i.trim().to_lowercase()).collect(); let tags = arg_m.values_of("tags").unwrap_or_default().collect();
let query = arg_m.values_of("query").unwrap_or_default().collect::<Vec<_>>().join(" "); let query = arg_m.values_of("query").unwrap_or_default().collect::<Vec<_>>().join(" ");
let query = query.trim(); let query = query.trim();
let results = utils::search(Client::new(), query, tags, broad_search).await.unwrap(); let results = utils::search(Client::new(), query, tags, broad_search).await.unwrap();

View File

@ -5,7 +5,7 @@ use quick_xml::events::Event;
extern crate reqwest; extern crate reqwest;
extern crate serde_json; extern crate serde_json;
pub async fn search(client: reqwest::Client, query: &str, tags: Vec<String>, broad_search: bool) -> Result<Vec<structs::SearchResult>, structs::Error> { pub async fn search(client: reqwest::Client, query: &str, tags: Vec<&str>, broad_search: bool) -> Result<Vec<structs::SearchResult>, structs::Error> {
let tags_mode = match broad_search { let tags_mode = match broad_search {
true => "OR", true => "OR",
false => "AND" false => "AND"