From 41f72b2513bf2334712ec9badbed597bdfc8e0fd Mon Sep 17 00:00:00 2001 From: Caleb Hattingh Date: Tue, 23 Apr 2024 01:36:48 +0200 Subject: [PATCH] Fix lints from recent PR (#248) --- src/query.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/query.rs b/src/query.rs index 8d2730a..bf036fe 100644 --- a/src/query.rs +++ b/src/query.rs @@ -1,12 +1,14 @@ use crate::{make_term, Schema}; -use pyo3::{exceptions, prelude::*, types::PyAny, types::PyString, types::PyTuple}; +use pyo3::{ + exceptions, prelude::*, types::PyAny, types::PyString, types::PyTuple, +}; use tantivy as tv; /// Custom Tuple struct to represent a pair of Occur and Query /// for the BooleanQuery struct OccurQueryPair(Occur, Query); -impl <'source> FromPyObject<'source> for OccurQueryPair { +impl<'source> FromPyObject<'source> for OccurQueryPair { fn extract(ob: &'source PyAny) -> PyResult { let tuple = ob.downcast::()?; let occur = tuple.get_item(0)?.extract()?; @@ -16,7 +18,6 @@ impl <'source> FromPyObject<'source> for OccurQueryPair { } } - /// Tantivy's Occur #[pyclass(frozen, module = "tantivy.tantivy")] #[derive(Clone)] @@ -137,13 +138,13 @@ impl Query { #[staticmethod] #[pyo3(signature = (subqueries))] pub(crate) fn boolean_query( - subqueries: Vec<(Occur, Query)> + subqueries: Vec<(Occur, Query)>, ) -> PyResult { let dyn_subqueries = subqueries .into_iter() .map(|(occur, query)| (occur.into(), query.inner.box_clone())) .collect::>(); - + let inner = tv::query::BooleanQuery::from(dyn_subqueries); Ok(Query {