From f117c90c466e662cddb0fd80668e2b01e1d07ce2 Mon Sep 17 00:00:00 2001 From: evpeople Date: Tue, 30 Aug 2022 21:49:34 +0800 Subject: [PATCH] remove the intermediate addition variable --- meilisearch-lib/src/index/updates.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/meilisearch-lib/src/index/updates.rs b/meilisearch-lib/src/index/updates.rs index 6507fc343..b6f601753 100644 --- a/meilisearch-lib/src/index/updates.rs +++ b/meilisearch-lib/src/index/updates.rs @@ -331,13 +331,10 @@ impl Index { builder = new_builder; let user_result = match user_result { - Ok(count) => { - let addition = DocumentAdditionResult { - indexed_documents: count, - number_of_documents: count, - }; - Ok(addition) - } + Ok(count) => Ok(DocumentAdditionResult { + indexed_documents: count, + number_of_documents: count, + }), Err(e) => Err(IndexError::from(e)), }; @@ -345,9 +342,9 @@ impl Index { } if results.iter().any(Result::is_ok) { - let _addition = builder.execute()?; + let addition = builder.execute()?; txn.commit()?; - info!("document addition done: {:?}", _addition); + info!("document addition done: {:?}", addition); } Ok(results)