diff --git a/bitpacker/src/bitpacker.rs b/bitpacker/src/bitpacker.rs index 65cd3abe03..903daccf81 100644 --- a/bitpacker/src/bitpacker.rs +++ b/bitpacker/src/bitpacker.rs @@ -367,7 +367,7 @@ mod test { let mut output: Vec = Vec::new(); for len in [0, 1, 2, 32, 33, 34, 64] { for start_idx in 0u32..32u32 { - output.resize(len as usize, 0); + output.resize(len, 0); bitunpacker.get_batch_u32s(start_idx, &buffer, &mut output); for i in 0..len { let expected = (start_idx + i as u32) & mask; diff --git a/columnar/src/column_index/optional_index/tests.rs b/columnar/src/column_index/optional_index/tests.rs index 6149b1ec36..2acc5f6e6f 100644 --- a/columnar/src/column_index/optional_index/tests.rs +++ b/columnar/src/column_index/optional_index/tests.rs @@ -215,12 +215,12 @@ mod bench { let vals: Vec = (0..TOTAL_NUM_VALUES) .map(|_| rng.gen_bool(fill_ratio)) .enumerate() - .filter(|(pos, val)| *val) + .filter(|(_pos, val)| *val) .map(|(pos, _)| pos as RowId) .collect(); serialize_optional_index(&&vals[..], TOTAL_NUM_VALUES, &mut out).unwrap(); - let codec = open_optional_index(OwnedBytes::new(out)).unwrap(); - codec + + open_optional_index(OwnedBytes::new(out)).unwrap() } fn random_range_iterator( @@ -242,7 +242,7 @@ mod bench { } fn n_percent_step_iterator(percent: f32, num_values: u32) -> impl Iterator { - let ratio = percent as f32 / 100.0; + let ratio = percent / 100.0; let step_size = (1f32 / ratio) as u32; let deviation = step_size - 1; random_range_iterator(0, num_values, step_size, deviation) diff --git a/columnar/src/tests.rs b/columnar/src/tests.rs index 6e4cc84483..2d45080b91 100644 --- a/columnar/src/tests.rs +++ b/columnar/src/tests.rs @@ -330,9 +330,9 @@ fn bytes_strategy() -> impl Strategy { // A random column value fn column_value_strategy() -> impl Strategy { prop_oneof![ - 10 => string_strategy().prop_map(|s| ColumnValue::Str(s)), - 1 => bytes_strategy().prop_map(|b| ColumnValue::Bytes(b)), - 40 => num_strategy().prop_map(|n| ColumnValue::Numerical(n)), + 10 => string_strategy().prop_map(ColumnValue::Str), + 1 => bytes_strategy().prop_map(ColumnValue::Bytes), + 40 => num_strategy().prop_map(ColumnValue::Numerical), 1 => (1u16..3u16).prop_map(|ip_addr_byte| ColumnValue::IpAddr(Ipv6Addr::new( 127, 0, @@ -343,7 +343,7 @@ fn column_value_strategy() -> impl Strategy { 0, ip_addr_byte ))), - 1 => any::().prop_map(|b| ColumnValue::Bool(b)), + 1 => any::().prop_map(ColumnValue::Bool), 1 => (0_679_723_993i64..1_679_723_995i64) .prop_map(|val| { ColumnValue::DateTime(DateTime::from_timestamp_secs(val)) }) ] @@ -419,8 +419,8 @@ fn build_columnar_with_mapping( columnar_writer .serialize(num_docs, old_to_new_row_ids_opt, &mut buffer) .unwrap(); - let columnar_reader = ColumnarReader::open(buffer).unwrap(); - columnar_reader + + ColumnarReader::open(buffer).unwrap() } fn build_columnar(docs: &[Vec<(&'static str, ColumnValue)>]) -> ColumnarReader { @@ -746,7 +746,7 @@ proptest! { let stack_merge_order = StackMergeOrder::stack(&columnar_readers_arr[..]).into(); crate::merge_columnar(&columnar_readers_arr[..], &[], stack_merge_order, &mut output).unwrap(); let merged_columnar = ColumnarReader::open(output).unwrap(); - let concat_rows: Vec> = columnar_docs.iter().cloned().flatten().collect(); + let concat_rows: Vec> = columnar_docs.iter().flatten().cloned().collect(); let expected_merged_columnar = build_columnar(&concat_rows[..]); assert_columnar_eq_strict(&merged_columnar, &expected_merged_columnar); } @@ -772,7 +772,7 @@ fn test_columnar_merging_empty_columnar() { .unwrap(); let merged_columnar = ColumnarReader::open(output).unwrap(); let concat_rows: Vec> = - columnar_docs.iter().cloned().flatten().collect(); + columnar_docs.iter().flatten().cloned().collect(); let expected_merged_columnar = build_columnar(&concat_rows[..]); assert_columnar_eq_strict(&merged_columnar, &expected_merged_columnar); } @@ -809,7 +809,7 @@ fn test_columnar_merging_number_columns() { .unwrap(); let merged_columnar = ColumnarReader::open(output).unwrap(); let concat_rows: Vec> = - columnar_docs.iter().cloned().flatten().collect(); + columnar_docs.iter().flatten().cloned().collect(); let expected_merged_columnar = build_columnar(&concat_rows[..]); assert_columnar_eq_strict(&merged_columnar, &expected_merged_columnar); } diff --git a/src/aggregation/agg_bench.rs b/src/aggregation/agg_bench.rs index a78e748bd1..ec534d9940 100644 --- a/src/aggregation/agg_bench.rs +++ b/src/aggregation/agg_bench.rs @@ -48,7 +48,7 @@ mod bench { let score_field_f64 = schema_builder.add_f64_field("score_f64", score_fieldtype.clone()); let score_field_i64 = schema_builder.add_i64_field("score_i64", score_fieldtype); let index = Index::create_from_tempdir(schema_builder.build())?; - let few_terms_data = vec!["INFO", "ERROR", "WARN", "DEBUG"]; + let few_terms_data = ["INFO", "ERROR", "WARN", "DEBUG"]; let lg_norm = rand_distr::LogNormal::new(2.996f64, 0.979f64).unwrap(); @@ -85,7 +85,7 @@ mod bench { if cardinality == Cardinality::Sparse { doc_with_value /= 20; } - let val_max = 1_000_000.0; + let _val_max = 1_000_000.0; for _ in 0..doc_with_value { let val: f64 = rng.gen_range(0.0..1_000_000.0); let json = if rng.gen_bool(0.1) { diff --git a/src/indexer/merger_sorted_index_test.rs b/src/indexer/merger_sorted_index_test.rs index 045722d2d2..d27eab4ed6 100644 --- a/src/indexer/merger_sorted_index_test.rs +++ b/src/indexer/merger_sorted_index_test.rs @@ -543,7 +543,7 @@ mod bench_sorted_index_merge { //); //(doc_addr.doc_id, reader, u64_reader) //}); - //// add values in order of the new doc_ids + /// add values in order of the new doc_ids // let mut val = 0; // for (doc_id, _reader, field_reader) in sorted_doc_ids { // val = field_reader.get_val(doc_id); diff --git a/src/schema/document/owned_value.rs b/src/schema/document/owned_value.rs index 457bdeb7ab..3369dd9790 100644 --- a/src/schema/document/owned_value.rs +++ b/src/schema/document/owned_value.rs @@ -369,7 +369,7 @@ impl From> for OwnedValue { fn can_be_rfc3339_date_time(text: &str) -> bool { if let Some(&first_byte) = text.as_bytes().first() { - if (b'0'..=b'9').contains(&first_byte) { + if first_byte.is_ascii_digit() { return true; } }