diff --git a/src/index.rs b/src/index.rs index a59d2f0..07912cd 100644 --- a/src/index.rs +++ b/src/index.rs @@ -8,7 +8,7 @@ use crate::document::{extract_value, Document}; use crate::query::Query; use crate::schema::Schema; use crate::searcher::Searcher; -use crate::{to_pyerr, get_field}; +use crate::{get_field, to_pyerr}; use tantivy as tv; use tantivy::directory::MmapDirectory; use tantivy::schema::{NamedFieldDocument, Term, Value}; @@ -80,8 +80,7 @@ impl IndexWriter { /// Detect and removes the files that are not used by the index anymore. fn garbage_collect_files(&mut self) -> PyResult<()> { use futures::executor::block_on; - block_on(self.inner_index_writer - .garbage_collect_files()) + block_on(self.inner_index_writer.garbage_collect_files()) .map_err(to_pyerr)?; Ok(()) } @@ -334,8 +333,7 @@ impl Index { } } } else { - for (field, field_entry) in self.index.schema().fields() - { + for (field, field_entry) in self.index.schema().fields() { if field_entry.is_indexed() { default_fields.push(field); } diff --git a/src/lib.rs b/src/lib.rs index 77cf565..4eaffbb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,11 +85,14 @@ pub(crate) fn to_pyerr(err: E) -> PyErr { exceptions::ValueError::py_err(err.to_string()) } -pub(crate) fn get_field(schema: &tv::schema::Schema, field_name: &str) -> PyResult { +pub(crate) fn get_field( + schema: &tv::schema::Schema, + field_name: &str, +) -> PyResult { let field = schema.get_field(field_name).ok_or_else(|| { exceptions::ValueError::py_err(format!( "Field `{}` is not defined in the schema.", - field_name + field_name )) })?; diff --git a/src/searcher.rs b/src/searcher.rs index 20868e0..97054a0 100644 --- a/src/searcher.rs +++ b/src/searcher.rs @@ -2,7 +2,7 @@ use crate::document::Document; use crate::query::Query; -use crate::{to_pyerr}; +use crate::to_pyerr; use pyo3::exceptions::ValueError; use pyo3::prelude::*; use pyo3::PyObjectProtocol;