From 3f09fd38c8e54a753df69b790e4211a0124f2706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Thu, 8 Aug 2019 13:55:19 +0200 Subject: [PATCH] tantivy: Fix some clippy warnings. --- src/document.rs | 4 ++-- src/query.rs | 2 +- src/searcher.rs | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/document.rs b/src/document.rs index 2eaa007..72a19cc 100644 --- a/src/document.rs +++ b/src/document.rs @@ -70,7 +70,7 @@ impl Document { fn add_date(&mut self, field: &Field, value: &PyDateTime) { let datetime = Utc .ymd( - value.get_year().into(), + value.get_year(), value.get_month().into(), value.get_day().into(), ) @@ -78,7 +78,7 @@ impl Document { value.get_hour().into(), value.get_minute().into(), value.get_second().into(), - value.get_microsecond().into(), + value.get_microsecond(), ); self.inner.add_date(field.inner, &datetime); diff --git a/src/query.rs b/src/query.rs index 89a5ff2..fc00734 100644 --- a/src/query.rs +++ b/src/query.rs @@ -36,7 +36,7 @@ impl QueryParser { default_fields: Vec<&Field>, ) -> PyResult { let default_fields: Vec = - default_fields.iter().map(|&f| f.inner.clone()).collect(); + default_fields.iter().map(|&f| f.inner).collect(); let parser = tv::query::QueryParser::for_index(&index.inner, default_fields); diff --git a/src/searcher.rs b/src/searcher.rs index 777cd43..2565cb9 100644 --- a/src/searcher.rs +++ b/src/searcher.rs @@ -36,10 +36,8 @@ impl Searcher { let ret = self.inner.search(&query.inner, &collector.inner); match ret { Ok(r) => { - let result: Vec<(f32, DocAddress)> = r - .iter() - .map(|(f, d)| (f.clone(), DocAddress::from(d))) - .collect(); + let result: Vec<(f32, DocAddress)> = + r.iter().map(|(f, d)| (*f, DocAddress::from(d))).collect(); Ok(result) } Err(e) => Err(exceptions::ValueError::py_err(e.to_string())),