From 07603373f3bb921276f2a4232ffe82b26946c3f8 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 31 Jan 2023 09:45:43 +0100 Subject: [PATCH 1/3] clippy: allow uninlined_format_args --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index f1260124e..0ff5ffc1d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -108,7 +108,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: clippy - args: --all-targets -- --deny warnings + args: --all-targets -- --deny warnings --allow clippy::uninlined_format_args fmt: name: Run Rustfmt From 771a367b978c55368dac48712d3c3af0af6ef987 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 31 Jan 2023 10:14:19 +0100 Subject: [PATCH 2/3] clippy: use rewind instead of seek 0 --- dump/src/lib.rs | 4 ++-- dump/src/reader/v5/mod.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dump/src/lib.rs b/dump/src/lib.rs index 7a7b9a5b7..6ca3e000e 100644 --- a/dump/src/lib.rs +++ b/dump/src/lib.rs @@ -198,7 +198,7 @@ impl From for KindDump { #[cfg(test)] pub(crate) mod test { use std::fs::File; - use std::io::{Seek, SeekFrom}; + use std::io::Seek; use std::str::FromStr; use big_s::S; @@ -410,7 +410,7 @@ pub(crate) mod test { // create the dump let mut file = tempfile::tempfile().unwrap(); dump.persist_to(&mut file).unwrap(); - file.seek(SeekFrom::Start(0)).unwrap(); + file.rewind().unwrap(); file } diff --git a/dump/src/reader/v5/mod.rs b/dump/src/reader/v5/mod.rs index 35bdcb453..3a22ca0a9 100644 --- a/dump/src/reader/v5/mod.rs +++ b/dump/src/reader/v5/mod.rs @@ -33,7 +33,7 @@ //! use std::fs::{self, File}; -use std::io::{BufRead, BufReader, ErrorKind, Seek, SeekFrom}; +use std::io::{BufRead, BufReader, ErrorKind, Seek}; use std::path::Path; use serde::{Deserialize, Serialize}; @@ -178,7 +178,7 @@ impl V5Reader { } pub fn keys(&mut self) -> Result> + '_>> { - self.keys.seek(SeekFrom::Start(0))?; + self.keys.rewind()?; Ok(Box::new( (&mut self.keys).lines().map(|line| -> Result<_> { Ok(serde_json::from_str(&line?)?) }), )) From 924d5d4c11e8f0e8fd3b7c116924a17cd0d4d8f8 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 31 Jan 2023 10:14:43 +0100 Subject: [PATCH 3/3] clippy: remove needless lifetimes --- index-scheduler/src/batch.rs | 4 ++-- meilisearch/src/search.rs | 8 ++++---- permissive-json-pointer/src/lib.rs | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/index-scheduler/src/batch.rs b/index-scheduler/src/batch.rs index bae92c37f..8a479a12b 100644 --- a/index-scheduler/src/batch.rs +++ b/index-scheduler/src/batch.rs @@ -960,9 +960,9 @@ impl IndexScheduler { /// /// ## Return /// The list of processed tasks. - fn apply_index_operation<'txn, 'i>( + fn apply_index_operation<'i>( &self, - index_wtxn: &'txn mut RwTxn<'i, '_>, + index_wtxn: &mut RwTxn<'i, '_>, index: &'i Index, operation: IndexOperation, ) -> Result> { diff --git a/meilisearch/src/search.rs b/meilisearch/src/search.rs index c199944f1..5cd9acee7 100644 --- a/meilisearch/src/search.rs +++ b/meilisearch/src/search.rs @@ -473,10 +473,10 @@ fn make_document( Ok(document) } -fn format_fields<'a, A: AsRef<[u8]>>( +fn format_fields>( document: &Document, field_ids_map: &FieldsIdsMap, - builder: &MatcherBuilder<'a, A>, + builder: &MatcherBuilder<'_, A>, formatted_options: &BTreeMap, compute_matches: bool, displayable_ids: &BTreeSet, @@ -521,9 +521,9 @@ fn format_fields<'a, A: AsRef<[u8]>>( Ok((matches_position, document)) } -fn format_value<'a, A: AsRef<[u8]>>( +fn format_value>( value: Value, - builder: &MatcherBuilder<'a, A>, + builder: &MatcherBuilder<'_, A>, format_options: Option, infos: &mut Vec, compute_matches: bool, diff --git a/permissive-json-pointer/src/lib.rs b/permissive-json-pointer/src/lib.rs index 039bd3320..7e5b3371c 100644 --- a/permissive-json-pointer/src/lib.rs +++ b/permissive-json-pointer/src/lib.rs @@ -72,9 +72,9 @@ pub fn map_leaf_values<'a>( map_leaf_values_in_object(value, &selectors, "", &mut mapper); } -pub fn map_leaf_values_in_object<'a>( +pub fn map_leaf_values_in_object( value: &mut Map, - selectors: &[&'a str], + selectors: &[&str], base_key: &str, mapper: &mut impl FnMut(&str, &mut Value), ) {