From 0c04cd1d9f94c907f1f7366548b3fafb2318d80f Mon Sep 17 00:00:00 2001 From: Tamo Date: Mon, 16 Dec 2024 15:52:47 +0100 Subject: [PATCH] make clippy happy --- .../meilisearch/src/routes/indexes/search.rs | 3 +- .../src/routes/indexes/search_test.rs | 43 +++++++++---------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/crates/meilisearch/src/routes/indexes/search.rs b/crates/meilisearch/src/routes/indexes/search.rs index 6ada1d699..bbf91ba1f 100644 --- a/crates/meilisearch/src/routes/indexes/search.rs +++ b/crates/meilisearch/src/routes/indexes/search.rs @@ -355,4 +355,5 @@ pub fn search_kind( (_, None, Some(_)) => Err(MeilisearchHttpError::MissingSearchHybrid.into()), } -} \ No newline at end of file +} + diff --git a/crates/meilisearch/src/routes/indexes/search_test.rs b/crates/meilisearch/src/routes/indexes/search_test.rs index fb9ef6154..b56fb4e8b 100644 --- a/crates/meilisearch/src/routes/indexes/search_test.rs +++ b/crates/meilisearch/src/routes/indexes/search_test.rs @@ -1,25 +1,22 @@ -pub mod search_test { - use crate::routes::indexes::search::fix_sort_query_parameters; +use crate::routes::indexes::search::fix_sort_query_parameters; - #[test] - fn test_fix_sort_query_parameters() { - let sort = fix_sort_query_parameters("_geoPoint(12, 13):asc"); - assert_eq!(sort, vec!["_geoPoint(12,13):asc".to_string()]); - let sort = fix_sort_query_parameters("doggo:asc,_geoPoint(12.45,13.56):desc"); - assert_eq!(sort, vec!["doggo:asc".to_string(), "_geoPoint(12.45,13.56):desc".to_string(),]); - let sort = fix_sort_query_parameters( - "doggo:asc , _geoPoint(12.45, 13.56, 2590352):desc , catto:desc", - ); - assert_eq!( - sort, - vec![ - "doggo:asc".to_string(), - "_geoPoint(12.45,13.56,2590352):desc".to_string(), - "catto:desc".to_string(), - ] - ); - let sort = fix_sort_query_parameters("doggo:asc , _geoPoint(1, 2), catto:desc"); - // This is ugly but eh, I don't want to write a full parser just for this unused route - assert_eq!(sort, vec!["doggo:asc".to_string(), "_geoPoint(1,2),catto:desc".to_string(),]); - } +#[test] +fn test_fix_sort_query_parameters() { + let sort = fix_sort_query_parameters("_geoPoint(12, 13):asc"); + assert_eq!(sort, vec!["_geoPoint(12,13):asc".to_string()]); + let sort = fix_sort_query_parameters("doggo:asc,_geoPoint(12.45,13.56):desc"); + assert_eq!(sort, vec!["doggo:asc".to_string(), "_geoPoint(12.45,13.56):desc".to_string(),]); + let sort = + fix_sort_query_parameters("doggo:asc , _geoPoint(12.45, 13.56, 2590352):desc , catto:desc"); + assert_eq!( + sort, + vec![ + "doggo:asc".to_string(), + "_geoPoint(12.45,13.56,2590352):desc".to_string(), + "catto:desc".to_string(), + ] + ); + let sort = fix_sort_query_parameters("doggo:asc , _geoPoint(1, 2), catto:desc"); + // This is ugly but eh, I don't want to write a full parser just for this unused route + assert_eq!(sort, vec!["doggo:asc".to_string(), "_geoPoint(1,2),catto:desc".to_string(),]); }