From 8d624b38000e9de15bbb470e2388161a5b7971da Mon Sep 17 00:00:00 2001 From: Rob Ede Date: Mon, 28 Feb 2022 13:43:22 +0000 Subject: [PATCH] clippy --- Cargo.lock | 2 +- meilisearch-http/Cargo.toml | 2 +- meilisearch-http/src/analytics/mod.rs | 2 +- meilisearch-http/tests/snapshot/mod.rs | 5 +---- meilisearch-lib/src/index/index.rs | 2 +- .../src/index_controller/dump_actor/compat/mod.rs | 4 ++-- meilisearch-lib/src/tasks/scheduler.rs | 2 +- meilisearch-lib/src/tasks/task_store/store.rs | 10 +++++----- 8 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fd8fade6a..3a5f8cb7a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -221,7 +221,7 @@ dependencies = [ [[package]] name = "actix-web-static-files" version = "3.0.5" -source = "git+https://github.com/robjtede/actix-web-static-files.git?rev=baebe8e3#baebe8e36d4a019113b43fbed908192cf34fa6c4" +source = "git+https://github.com/kilork/actix-web-static-files.git?rev=2d3b6160#2d3b6160f0de4ba061c5d76b5704f34fb677f6df" dependencies = [ "actix-web", "derive_more", diff --git a/meilisearch-http/Cargo.toml b/meilisearch-http/Cargo.toml index c59800e83..122da85e6 100644 --- a/meilisearch-http/Cargo.toml +++ b/meilisearch-http/Cargo.toml @@ -24,7 +24,7 @@ zip = { version = "0.5.13", optional = true } [dependencies] actix-cors = "0.6" actix-web = { version = "4", features = ["rustls"] } -actix-web-static-files = { git = "https://github.com/robjtede/actix-web-static-files.git", rev = "baebe8e3", optional = true } +actix-web-static-files = { git = "https://github.com/kilork/actix-web-static-files.git", rev = "2d3b6160", optional = true } anyhow = { version = "1.0.43", features = ["backtrace"] } arc-swap = "1.3.2" async-stream = "0.3.2" diff --git a/meilisearch-http/src/analytics/mod.rs b/meilisearch-http/src/analytics/mod.rs index caeb7b7c0..1d37a053d 100644 --- a/meilisearch-http/src/analytics/mod.rs +++ b/meilisearch-http/src/analytics/mod.rs @@ -44,7 +44,7 @@ fn config_user_id_path(db_path: &Path) -> Option { path.join("instance-uid") .display() .to_string() - .replace("/", "-") + .replace('/', "-") }) .zip(MEILISEARCH_CONFIG_PATH.as_ref()) .map(|(filename, config_path)| config_path.join(filename.trim_start_matches('-'))) diff --git a/meilisearch-http/tests/snapshot/mod.rs b/meilisearch-http/tests/snapshot/mod.rs index 3a5c99b2d..5c626a888 100644 --- a/meilisearch-http/tests/snapshot/mod.rs +++ b/meilisearch-http/tests/snapshot/mod.rs @@ -60,10 +60,7 @@ async fn perform_snapshot() { let temp = tempfile::tempdir().unwrap(); - let snapshot_path = snapshot_dir - .path() - .to_owned() - .join("db.snapshot".to_string()); + let snapshot_path = snapshot_dir.path().to_owned().join("db.snapshot"); let options = Opt { import_snapshot: Some(snapshot_path), diff --git a/meilisearch-lib/src/index/index.rs b/meilisearch-lib/src/index/index.rs index 41803b6d5..597c1a283 100644 --- a/meilisearch-lib/src/index/index.rs +++ b/meilisearch-lib/src/index/index.rs @@ -150,7 +150,7 @@ impl Index { Ok(stop_words.stream().into_strs()?.into_iter().collect()) }) .transpose()? - .unwrap_or_else(BTreeSet::new); + .unwrap_or_default(); let distinct_field = self.distinct_field(txn)?.map(String::from); // in milli each word in the synonyms map were split on their separator. Since we lost diff --git a/meilisearch-lib/src/index_controller/dump_actor/compat/mod.rs b/meilisearch-lib/src/index_controller/dump_actor/compat/mod.rs index ad069f61c..93f3f9dd7 100644 --- a/meilisearch-lib/src/index_controller/dump_actor/compat/mod.rs +++ b/meilisearch-lib/src/index_controller/dump_actor/compat/mod.rs @@ -4,13 +4,13 @@ pub mod v3; /// Parses the v1 version of the Asc ranking rules `asc(price)`and returns the field name. pub fn asc_ranking_rule(text: &str) -> Option<&str> { text.split_once("asc(") - .and_then(|(_, tail)| tail.rsplit_once(")")) + .and_then(|(_, tail)| tail.rsplit_once(')')) .map(|(field, _)| field) } /// Parses the v1 version of the Desc ranking rules `desc(price)`and returns the field name. pub fn desc_ranking_rule(text: &str) -> Option<&str> { text.split_once("desc(") - .and_then(|(_, tail)| tail.rsplit_once(")")) + .and_then(|(_, tail)| tail.rsplit_once(')')) .map(|(field, _)| field) } diff --git a/meilisearch-lib/src/tasks/scheduler.rs b/meilisearch-lib/src/tasks/scheduler.rs index bbb9cb2e2..695f6c11f 100644 --- a/meilisearch-lib/src/tasks/scheduler.rs +++ b/meilisearch-lib/src/tasks/scheduler.rs @@ -443,7 +443,7 @@ mod test { fn gen_task(id: TaskId, index_uid: &str, content: TaskContent) -> Task { Task { id, - index_uid: IndexUid::new_unchecked(index_uid.to_owned()), + index_uid: IndexUid::new_unchecked(index_uid), content, events: vec![], } diff --git a/meilisearch-lib/src/tasks/task_store/store.rs b/meilisearch-lib/src/tasks/task_store/store.rs index 6032eec2c..582cfe27c 100644 --- a/meilisearch-lib/src/tasks/task_store/store.rs +++ b/meilisearch-lib/src/tasks/task_store/store.rs @@ -325,7 +325,7 @@ pub mod test { let tasks = (0..100) .map(|_| Task { id: rand::random(), - index_uid: IndexUid::new_unchecked("test".to_string()), + index_uid: IndexUid::new_unchecked("test"), content: TaskContent::IndexDeletion, events: vec![], }) @@ -356,14 +356,14 @@ pub mod test { let task_1 = Task { id: 1, - index_uid: IndexUid::new_unchecked("test".to_string()), + index_uid: IndexUid::new_unchecked("test"), content: TaskContent::IndexDeletion, events: vec![], }; let task_2 = Task { id: 0, - index_uid: IndexUid::new_unchecked("test1".to_string()), + index_uid: IndexUid::new_unchecked("test1"), content: TaskContent::IndexDeletion, events: vec![], }; @@ -384,13 +384,13 @@ pub mod test { // same thing but invert the ids let task_1 = Task { id: 0, - index_uid: IndexUid::new_unchecked("test".to_string()), + index_uid: IndexUid::new_unchecked("test"), content: TaskContent::IndexDeletion, events: vec![], }; let task_2 = Task { id: 1, - index_uid: IndexUid::new_unchecked("test1".to_string()), + index_uid: IndexUid::new_unchecked("test1"), content: TaskContent::IndexDeletion, events: vec![], };