From 7af1b68a453e86cd605a896ed652c4f1b5b8c852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Sun, 20 Sep 2020 10:19:29 +0200 Subject: [PATCH] tantivy: Merge our imports. --- src/document.rs | 18 +++++++++--------- src/facet.rs | 4 +--- src/index.rs | 23 +++++++++++++---------- src/lib.rs | 3 +-- src/query.rs | 3 +-- src/schemabuilder.rs | 3 +-- src/searcher.rs | 8 ++------ 7 files changed, 28 insertions(+), 34 deletions(-) diff --git a/src/document.rs b/src/document.rs index 2818bf3..8d831c0 100644 --- a/src/document.rs +++ b/src/document.rs @@ -2,20 +2,20 @@ #![allow(clippy::wrong_self_convention)] use itertools::Itertools; -use pyo3::prelude::*; -use pyo3::types::{PyAny, PyDateTime, PyDict, PyList, PyTuple}; -use pyo3::types::{PyDateAccess, PyTimeAccess}; +use pyo3::{ + prelude::*, + types::{ + PyAny, PyDateAccess, PyDateTime, PyDict, PyList, PyTimeAccess, PyTuple, + }, +}; -use chrono::offset::TimeZone; -use chrono::{Datelike, Timelike, Utc}; +use chrono::{offset::TimeZone, Datelike, Timelike, Utc}; use tantivy as tv; -use crate::facet::Facet; -use crate::to_pyerr; +use crate::{facet::Facet, to_pyerr}; use pyo3::{PyMappingProtocol, PyObjectProtocol}; -use std::collections::BTreeMap; -use std::fmt; +use std::{collections::BTreeMap, fmt}; use tantivy::schema::Value; fn value_to_py(py: Python, value: &Value) -> PyResult { diff --git a/src/facet.rs b/src/facet.rs index 3216b30..82144e2 100644 --- a/src/facet.rs +++ b/src/facet.rs @@ -1,6 +1,4 @@ -use pyo3::basic::PyObjectProtocol; -use pyo3::prelude::*; -use pyo3::types::PyType; +use pyo3::{basic::PyObjectProtocol, prelude::*, types::PyType}; use tantivy::schema; /// A Facet represent a point in a given hierarchy. diff --git a/src/index.rs b/src/index.rs index 18523d7..8c8c9fa 100644 --- a/src/index.rs +++ b/src/index.rs @@ -1,17 +1,20 @@ #![allow(clippy::new_ret_no_self)] -use pyo3::exceptions; -use pyo3::prelude::*; -use pyo3::types::PyAny; +use pyo3::{exceptions, prelude::*, types::PyAny}; -use crate::document::{extract_value, Document}; -use crate::query::Query; -use crate::schema::Schema; -use crate::searcher::Searcher; -use crate::{get_field, to_pyerr}; +use crate::{ + document::{extract_value, Document}, + get_field, + query::Query, + schema::Schema, + searcher::Searcher, + to_pyerr, +}; use tantivy as tv; -use tantivy::directory::MmapDirectory; -use tantivy::schema::{NamedFieldDocument, Term, Value}; +use tantivy::{ + directory::MmapDirectory, + schema::{NamedFieldDocument, Term, Value}, +}; const RELOAD_POLICY: &str = "commit"; diff --git a/src/lib.rs b/src/lib.rs index 7adb19e..0593715 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,4 @@ -use pyo3::exceptions; -use pyo3::prelude::*; +use pyo3::{exceptions, prelude::*}; use tantivy as tv; mod document; diff --git a/src/query.rs b/src/query.rs index 1023309..e520953 100644 --- a/src/query.rs +++ b/src/query.rs @@ -1,5 +1,4 @@ -use pyo3::prelude::*; -use pyo3::PyObjectProtocol; +use pyo3::{prelude::*, PyObjectProtocol}; use tantivy as tv; /// Tantivy's Query diff --git a/src/schemabuilder.rs b/src/schemabuilder.rs index 683e48f..58b2a27 100644 --- a/src/schemabuilder.rs +++ b/src/schemabuilder.rs @@ -1,7 +1,6 @@ #![allow(clippy::new_ret_no_self)] -use pyo3::exceptions; -use pyo3::prelude::*; +use pyo3::{exceptions, prelude::*}; use tantivy::schema; diff --git a/src/searcher.rs b/src/searcher.rs index 2f2c256..2f0cc1b 100644 --- a/src/searcher.rs +++ b/src/searcher.rs @@ -1,11 +1,7 @@ #![allow(clippy::new_ret_no_self)] -use crate::document::Document; -use crate::query::Query; -use crate::{get_field, to_pyerr}; -use pyo3::exceptions::PyValueError; -use pyo3::prelude::*; -use pyo3::PyObjectProtocol; +use crate::{document::Document, get_field, query::Query, to_pyerr}; +use pyo3::{exceptions::PyValueError, prelude::*, PyObjectProtocol}; use tantivy as tv; use tantivy::collector::{Count, MultiCollector, TopDocs};