diff --git a/src/document.rs b/src/document.rs index 1592d5a..f55ef81 100644 --- a/src/document.rs +++ b/src/document.rs @@ -1,5 +1,3 @@ - - use napi::{bindgen_prelude::*, Error, JsNumber, Result, Status, ValueType}; use napi_derive::napi; diff --git a/src/index.rs b/src/index.rs index 54f61e0..3531d1f 100644 --- a/src/index.rs +++ b/src/index.rs @@ -1,5 +1,3 @@ - - use std::collections::HashMap; use napi::bindgen_prelude::*; diff --git a/src/lib.rs b/src/lib.rs index 3db45c1..a38681f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -103,7 +103,6 @@ pub(crate) fn make_term_for_type( } } - pub mod document; pub mod explanation; pub mod facet; diff --git a/src/parser_error.rs b/src/parser_error.rs index 5cbfb0c..e1edcf0 100644 --- a/src/parser_error.rs +++ b/src/parser_error.rs @@ -804,7 +804,10 @@ impl IpFormatError { impl QueryParserError for IpFormatError { fn full_message(&self) -> String { - format!("The IP address field is malformed: {0}", self.addr_parse_error) + format!( + "The IP address field is malformed: {0}", + self.addr_parse_error + ) } } diff --git a/src/searcher.rs b/src/searcher.rs index 4eb19ae..5533777 100644 --- a/src/searcher.rs +++ b/src/searcher.rs @@ -1,5 +1,3 @@ - - use crate::{document::Document, query::Query}; use napi::bindgen_prelude::*; use napi::{Error, Result, Status}; @@ -22,8 +20,6 @@ pub struct Searcher { pub(crate) inner: tv::Searcher, } - - #[napi] #[derive(Deserialize, PartialEq, Serialize)] /// Enum representing the direction in which something should be sorted. diff --git a/src/snippet.rs b/src/snippet.rs index 10576d6..87d1a1e 100644 --- a/src/snippet.rs +++ b/src/snippet.rs @@ -60,10 +60,12 @@ impl SnippetGenerator { schema: &crate::Schema, field_name: String, ) -> Result { - let field = schema - .inner - .get_field(&field_name) - .map_err(|_| Error::new(napi::Status::InvalidArg, format!("Field '{}' not found", field_name)))?; + let field = schema.inner.get_field(&field_name).map_err(|_| { + Error::new( + napi::Status::InvalidArg, + format!("Field '{}' not found", field_name), + ) + })?; let generator = tv::snippet::SnippetGenerator::create(&searcher.inner, query.get(), field) .map_err(|e| Error::new(napi::Status::GenericFailure, e.to_string()))?; diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 2e9adad..cc215fc 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -364,16 +364,22 @@ impl TextAnalyzerBuilder { Err(e) => return Err(e), }, FilterType::StopWord { language } => match parse_language(language) { - Ok(lang) => builder.filter_dynamic(tvt::StopWordFilter::new(lang) - .ok_or_else(|| Error::from_reason(format!("Failed to create stop word filter for language: {:?}", language)))?), + Ok(lang) => builder.filter_dynamic(tvt::StopWordFilter::new(lang).ok_or_else(|| { + Error::from_reason(format!( + "Failed to create stop word filter for language: {:?}", + language + )) + })?), Err(e) => return Err(e), }, FilterType::CustomStopWord { stopwords } => { builder.filter_dynamic(tvt::StopWordFilter::remove(stopwords.clone())) } - FilterType::SplitCompound { constituent_words } => builder - .filter_dynamic(tvt::SplitCompoundWords::from_dictionary(constituent_words) - .map_err(|e| Error::from_reason(format!("Failed to create compound splitter: {}", e)))?), + FilterType::SplitCompound { constituent_words } => builder.filter_dynamic( + tvt::SplitCompoundWords::from_dictionary(constituent_words).map_err(|e| { + Error::from_reason(format!("Failed to create compound splitter: {}", e)) + })?, + ), }; Ok(TextAnalyzerBuilder { builder: Some(new_builder),