mirror of
https://github.com/msfjarvis/linkleaner.git
synced 2024-06-03 02:08:11 +05:30
Fix clippy lints
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
b922aa32a5
commit
a834366887
|
@ -11,15 +11,13 @@ pub(crate) fn file_name_to_label(msg: String) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_search_results(items: Vec<String>, search_term: &str) -> Vec<String> {
|
pub(crate) fn get_search_results(items: Vec<String>, search_term: &str) -> Vec<String> {
|
||||||
if search_term.contains("_") {
|
if search_term.contains('_') {
|
||||||
items
|
items
|
||||||
.clone()
|
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|x| x.starts_with(&search_term))
|
.filter(|x| x.starts_with(&search_term))
|
||||||
.collect()
|
.collect()
|
||||||
} else {
|
} else {
|
||||||
items
|
items
|
||||||
.clone()
|
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|x| tokenized_search(x.to_string(), &search_term))
|
.filter(|x| tokenized_search(x.to_string(), &search_term))
|
||||||
.collect()
|
.collect()
|
||||||
|
@ -101,7 +99,7 @@ mod tests {
|
||||||
file_name_to_label("John_Doe_1.jpg".to_string()),
|
file_name_to_label("John_Doe_1.jpg".to_string()),
|
||||||
"John Doe 1".to_string()
|
"John Doe 1".to_string()
|
||||||
);
|
);
|
||||||
assert!(!file_name_to_label("Jane_Doe.jpg".to_string()).contains("_"))
|
assert!(!file_name_to_label("Jane_Doe.jpg".to_string()).contains('_'))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user