From 3a9727aa918ab1cc122d48f9dbd2abdd53127bfd Mon Sep 17 00:00:00 2001 From: Paul Masurel Date: Sat, 27 Aug 2022 11:33:03 +0200 Subject: [PATCH] Pleasing Clippy --- fastfield_codecs/src/blockwise_linear.rs | 3 +-- src/fastfield/gcd.rs | 12 ++++++------ src/snippet/mod.rs | 11 ++++------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/fastfield_codecs/src/blockwise_linear.rs b/fastfield_codecs/src/blockwise_linear.rs index 30f073e79..6f59763b5 100644 --- a/fastfield_codecs/src/blockwise_linear.rs +++ b/fastfield_codecs/src/blockwise_linear.rs @@ -19,8 +19,7 @@ use tantivy_bitpacker::{compute_num_bits, BitPacker, BitUnpacker}; use crate::linear::{get_calculated_value, get_slope}; use crate::{ - blockwise_linear, FastFieldCodecReader, FastFieldCodecSerializer, FastFieldCodecType, - FastFieldDataAccess, + FastFieldCodecReader, FastFieldCodecSerializer, FastFieldCodecType, FastFieldDataAccess, }; const CHUNK_SIZE: u64 = 512; diff --git a/src/fastfield/gcd.rs b/src/fastfield/gcd.rs index 46000aa00..50cb2594a 100644 --- a/src/fastfield/gcd.rs +++ b/src/fastfield/gcd.rs @@ -147,7 +147,7 @@ mod tests { let val = (i as i64 - 5) * 1000i64; docs.push(doc!(*FIELDI64=>val)); } - let directory = get_index(&docs, &SCHEMAI64, code_type.clone().into())?; + let directory = get_index(&docs, &SCHEMAI64, code_type.into())?; let file = directory.open_read(path).unwrap(); let composite_file = CompositeFile::open(&file)?; let file = composite_file.open_read(*FIELD).unwrap(); @@ -173,8 +173,8 @@ mod tests { #[test] fn test_fastfield_gcd_i64() -> crate::Result<()> { - for code_type in ALL_CODECS { - test_fastfield_gcd_i64_with_codec(code_type.clone(), 5005)?; + for &code_type in ALL_CODECS { + test_fastfield_gcd_i64_with_codec(code_type, 5005)?; } Ok(()) } @@ -189,7 +189,7 @@ mod tests { let val = i as u64 * 1000u64; docs.push(doc!(*FIELD=>val)); } - let directory = get_index(&docs, &SCHEMA, code_type.clone().into())?; + let directory = get_index(&docs, &SCHEMA, code_type.into())?; let file = directory.open_read(path).unwrap(); let composite_file = CompositeFile::open(&file)?; let file = composite_file.open_read(*FIELD).unwrap(); @@ -214,8 +214,8 @@ mod tests { #[test] fn test_fastfield_gcd_u64() -> crate::Result<()> { - for code_type in ALL_CODECS { - test_fastfield_gcd_u64_with_codec(code_type.clone(), 5005)?; + for &code_type in ALL_CODECS { + test_fastfield_gcd_u64_with_codec(code_type, 5005)?; } Ok(()) } diff --git a/src/snippet/mod.rs b/src/snippet/mod.rs index 9a9a9d371..3613e5444 100644 --- a/src/snippet/mod.rs +++ b/src/snippet/mod.rs @@ -638,17 +638,14 @@ Survey in 2016, 2017, and 2018."#; #[test] fn test_collapse_overlapped_ranges() { - assert_eq!( - collapse_overlapped_ranges(&vec![0..1, 2..3,]), - vec![0..1, 2..3] - ); + assert_eq!(&collapse_overlapped_ranges(&[0..1, 2..3,]), &[0..1, 2..3]); assert_eq!( collapse_overlapped_ranges(&vec![0..1, 1..2,]), vec![0..1, 1..2] ); - assert_eq!(collapse_overlapped_ranges(&vec![0..2, 1..2,]), vec![0..2]); - assert_eq!(collapse_overlapped_ranges(&vec![0..2, 1..3,]), vec![0..3]); - assert_eq!(collapse_overlapped_ranges(&vec![0..3, 1..2,]), vec![0..3]); + assert_eq!(collapse_overlapped_ranges(&[0..2, 1..2,]), vec![0..2]); + assert_eq!(collapse_overlapped_ranges(&[0..2, 1..3,]), vec![0..3]); + assert_eq!(collapse_overlapped_ranges(&[0..3, 1..2,]), vec![0..3]); } #[test]