clippy (#2661) #3533
Annotations
1 error and 34 warnings
coverage
Process completed with exit code 1.
|
coverage
Cache not found for keys: v0-rust-coverage-Linux-x64-7ffc47df-d643b6f4, v0-rust-coverage-Linux-x64-7ffc47df
|
this lint expectation is unfulfilled:
src/indexer/stamper.rs#L61
warning: this lint expectation is unfulfilled
--> src/indexer/stamper.rs:61:14
|
61 | #[expect(clippy::redundant_clone)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
this lint expectation is unfulfilled:
src/indexer/stamper.rs#L45
warning: this lint expectation is unfulfilled
--> src/indexer/stamper.rs:45:14
|
45 | #[expect(clippy::redundant_clone)]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
|
large size difference between variants:
src/aggregation/intermediate_agg_result.rs#L249
warning: large size difference between variants
--> src/aggregation/intermediate_agg_result.rs:249:1
|
249 | / pub enum IntermediateAggregationResult {
250 | | /// Bucket variant
251 | | Bucket(IntermediateBucketResult),
| | -------------------------------- the second-largest variant contains at least 56 bytes
252 | | /// Metric variant
253 | | Metric(IntermediateMetricResult),
| | -------------------------------- the largest variant contains at least 368 bytes
254 | | }
| |_^ the entire enum is at least 368 bytes
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#large_enum_variant
= note: `#[warn(clippy::large_enum_variant)]` on by default
help: consider boxing the large fields to reduce the total size of the enum
|
253 - Metric(IntermediateMetricResult),
253 + Metric(Box<IntermediateMetricResult>),
|
|
unused import: `std::iter`:
src/query/boolean_query/block_wand.rs#L305
warning: unused import: `std::iter`
--> src/query/boolean_query/block_wand.rs:305:9
|
305 | use std::iter;
| ^^^^^^^^^
|
unused import: `std::iter`:
src/positions/mod.rs#L44
warning: unused import: `std::iter`
--> src/positions/mod.rs:44:9
|
44 | use std::iter;
| ^^^^^^^^^
|
unused import: `std::iter`:
src/collector/facet_collector.rs#L487
warning: unused import: `std::iter`
--> src/collector/facet_collector.rs:487:9
|
487 | use std::iter;
| ^^^^^^^^^
|
unused import: `std::iter`:
src/tokenizer/ascii_folding_filter.rs#L1564
warning: unused import: `std::iter`
--> src/tokenizer/ascii_folding_filter.rs:1564:9
|
1564 | use std::iter;
| ^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
|
manually reimplementing `div_ceil`:
columnar/src/columnar/writer/column_operation.rs#L247
warning: manually reimplementing `div_ceil`
--> columnar/src/columnar/writer/column_operation.rs:247:5
|
247 | (msb + 7) / 8
| ^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `msb.div_ceil(8)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
|
manually reimplementing `div_ceil`:
columnar/src/column_values/u64_based/linear.rs#L120
warning: manually reimplementing `div_ceil`
--> columnar/src/column_values/u64_based/linear.rs:120:19
|
120 | + (num_bits as u64 * stats.num_rows as u64 + 7) / 8,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `(num_bits as u64 * stats.num_rows as u64).div_ceil(8)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
|
manually reimplementing `div_ceil`:
columnar/src/column_values/u64_based/bitpacked.rs#L108
warning: manually reimplementing `div_ceil`
--> columnar/src/column_values/u64_based/bitpacked.rs:108:34
|
108 | Some(stats.num_bytes() + (stats.num_rows as u64 * (num_bits_per_value as u64) + 7) / 8)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `(stats.num_rows as u64 * (num_bits_per_value as u64)).div_ceil(8)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
= note: `#[warn(clippy::manual_div_ceil)]` on by default
|
this `repeat().take()` can be written more concisely:
columnar/src/column_index/merge/stacked.rs#L110
warning: this `repeat().take()` can be written more concisely
--> columnar/src/column_index/merge/stacked.rs:110:22
|
110 | Box::new(std::iter::repeat(1u32).take(optional_index.num_non_nulls() as usize))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(1u32, optional_index.num_non_nulls() as usize)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n
|
this `repeat().take()` can be written more concisely:
columnar/src/column_index/merge/stacked.rs#L108
warning: this `repeat().take()` can be written more concisely
--> columnar/src/column_index/merge/stacked.rs:108:39
|
108 | ColumnIndex::Full => Box::new(std::iter::repeat(1u32).take(num_docs as usize)),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(1u32, num_docs as usize)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n
= note: `#[warn(clippy::manual_repeat_n)]` on by default
|
returning the result of a `let` binding from a block:
query-grammar/src/query_grammar.rs#L316
warning: returning the result of a `let` binding from a block
--> query-grammar/src/query_grammar.rs:316:5
|
308 | / let res = delimited_infallible(
309 | | nothing,
310 | | map(ast_infallible, |(mut ast, errors)| {
311 | | ast.set_default_field(field_name.to_string());
... |
314 | | opt_i_err(char(')'), "expected ')'"),
315 | | )(inp);
| |___________- unnecessary `let` binding
316 | res
| ^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
|
308 ~
309 ~ delimited_infallible(
310 + nothing,
311 + map(ast_infallible, |(mut ast, errors)| {
312 + ast.set_default_field(field_name.to_string());
313 + (ast, errors)
314 + }),
315 + opt_i_err(char(')'), "expected ')'"),
316 + )(inp)
|
|
manually reimplementing `div_ceil`:
sstable/src/sstable_index_v3.rs#L441
warning: manually reimplementing `div_ceil`
--> sstable/src/sstable_index_v3.rs:441:12
|
441 | if (range_end_addr + self.range_start_nbits as usize + 7) / 8 > data.len() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `(range_end_addr + self.range_start_nbits as usize).div_ceil(8)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
= note: `#[warn(clippy::manual_div_ceil)]` on by default
|
this can be `std::io::Error::other(_)`:
sstable/src/sstable_index_v3.rs#L397
warning: this can be `std::io::Error::other(_)`
--> sstable/src/sstable_index_v3.rs:397:47
|
397 | tantivy_fst::Error::Fst(fst_error) => io::Error::new(io::ErrorKind::Other, fst_error),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error
help: use `std::io::Error::other`
|
397 - tantivy_fst::Error::Fst(fst_error) => io::Error::new(io::ErrorKind::Other, fst_error),
397 + tantivy_fst::Error::Fst(fst_error) => io::Error::other(fst_error),
|
|
this can be `std::io::Error::other(_)`:
sstable/src/dictionary.rs#L311
warning: this can be `std::io::Error::other(_)`
--> sstable/src/dictionary.rs:311:28
|
311 | return Err(io::Error::new(
| ____________________________^
312 | | io::ErrorKind::Other,
313 | | format!("Unsupported sstable version, expected one of [2, 3], found {version}"),
314 | | ));
| |_________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error
= note: `#[warn(clippy::io_other_error)]` on by default
help: use `std::io::Error::other`
|
311 ~ return Err(io::Error::other(
312 ~ format!("Unsupported sstable version, expected one of [2, 3], found {version}"),
|
|
variables can be used directly in the `format!` string:
stacker/src/fastcpy.rs#L12
warning: variables can be used directly in the `format!` string
--> stacker/src/fastcpy.rs:12:9
|
12 | / panic!(
13 | | "source slice length ({}) does not match destination slice length ({})",
14 | | src_len, dst_len,
15 | | );
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `#[warn(clippy::uninlined_format_args)]` on by default
|
calling .bytes() is very inefficient when data is not in memory:
common/src/vint.rs#L199
warning: calling .bytes() is very inefficient when data is not in memory
--> common/src/vint.rs:199:25
|
199 | let mut bytes = reader.bytes();
| ^^^^^^^^^^^^^^
|
= help: consider using `BufReader`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unbuffered_bytes
|
calling .bytes() is very inefficient when data is not in memory:
common/src/vint.rs#L32
warning: calling .bytes() is very inefficient when data is not in memory
--> common/src/vint.rs:32:25
|
32 | let mut bytes = reader.bytes();
| ^^^^^^^^^^^^^^
|
= help: consider using `BufReader`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unbuffered_bytes
= note: `#[warn(clippy::unbuffered_bytes)]` on by default
|
manually reimplementing `div_ceil`:
common/src/bitset.rs#L186
warning: manually reimplementing `div_ceil`
--> common/src/bitset.rs:186:5
|
186 | (max_val + 63u32) / 64u32
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `max_val.div_ceil(64u32)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
= note: `#[warn(clippy::manual_div_ceil)]` on by default
|
returning the result of a `let` binding from a block:
bitpacker/src/blocked_bitpacker.rs#L146
warning: returning the result of a `let` binding from a block
--> bitpacker/src/blocked_bitpacker.rs:146:9
|
143 | / let iter = (0..bitpacked_elems)
144 | | .map(move |idx| self.get(idx))
145 | | .chain(self.buffer.iter().cloned());
| |________________________________________________- unnecessary `let` binding
146 | iter
| ^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return
= note: `#[warn(clippy::let_and_return)]` on by default
help: return the expression directly
|
143 ~
144 ~ (0..bitpacked_elems)
145 + .map(move |idx| self.get(idx))
146 + .chain(self.buffer.iter().cloned())
|
|
manually reimplementing `div_ceil`:
bitpacker/src/bitpacker.rs#L141
warning: manually reimplementing `div_ceil`
--> bitpacker/src/bitpacker.rs:141:29
|
141 | let end_byte_read = (end_bit_read + 7) / 8;
| ^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `end_bit_read.div_ceil(8)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
|
manually reimplementing `div_ceil`:
bitpacker/src/bitpacker.rs#L51
warning: manually reimplementing `div_ceil`
--> bitpacker/src/bitpacker.rs:51:29
|
51 | let num_bytes = (self.mini_buffer_written + 7) / 8;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `self.mini_buffer_written.div_ceil(8)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil
= note: `#[warn(clippy::manual_div_ceil)]` on by default
|
call to unsafe function `std::intrinsics::transmute` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L95
warning[E0133]: call to unsafe function `std::intrinsics::transmute` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:95:49
|
95 | 255 - std::arch::x86_64::_mm256_movemask_ps(std::mem::transmute::<DataType, __m256>(inside))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
--> bitpacker/src/filter_vec/avx2.rs:91:1
|
91 | unsafe fn compute_filter_bitset(val: __m256i, range: std::ops::RangeInclusive<__m256i>) -> u8 {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
call to unsafe function `std::ptr::mut_ptr::<impl *mut T>::offset_from` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L79
warning[E0133]: call to unsafe function `std::ptr::mut_ptr::<impl *mut T>::offset_from` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:79:5
|
79 | output_tail.offset_from(output) as usize
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
|
call to unsafe function `std::ptr::const_ptr::<impl *const T>::offset` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L77
warning[E0133]: call to unsafe function `std::ptr::const_ptr::<impl *const T>::offset` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:77:17
|
77 | input = input.offset(1);
| ^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
|
call to unsafe function `std::ptr::mut_ptr::<impl *mut T>::offset` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L75
warning[E0133]: call to unsafe function `std::ptr::mut_ptr::<impl *mut T>::offset` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:75:23
|
75 | output_tail = output_tail.offset(added_len as isize);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
|
call to unsafe function `std::arch::x86_64::_mm256_storeu_si256` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L74
warning[E0133]: call to unsafe function `std::arch::x86_64::_mm256_storeu_si256` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:74:9
|
74 | store_unaligned(output_tail as *mut __m256i, filtered_doc_ids);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
|
call to unsafe function `filter_vec::avx2::compact` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L73
warning[E0133]: call to unsafe function `filter_vec::avx2::compact` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:73:32
|
73 | let filtered_doc_ids = compact(ids, keeper_bitset);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
|
call to unsafe function `filter_vec::avx2::compute_filter_bitset` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L71
warning[E0133]: call to unsafe function `filter_vec::avx2::compute_filter_bitset` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:71:29
|
71 | let keeper_bitset = compute_filter_bitset(word, range_simd.clone());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
|
call to unsafe function `filter_vec::avx2::u32_to_i32_avx2` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L70
warning[E0133]: call to unsafe function `filter_vec::avx2::u32_to_i32_avx2` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:70:20
|
70 | let word = u32_to_i32_avx2(word);
| ^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
|
call to unsafe function `std::arch::x86_64::_mm256_lddqu_si256` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L69
warning[E0133]: call to unsafe function `std::arch::x86_64::_mm256_lddqu_si256` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:69:20
|
69 | let word = load_unaligned(input);
| ^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= note: consult the function's documentation for information on how to avoid undefined behavior
note: an unsafe function restricts its caller, but its body is safe by default
--> bitpacker/src/filter_vec/avx2.rs:48:1
|
48 | / unsafe fn filter_vec_avx2_aux(
49 | | mut input: *const __m256i,
50 | | range: RangeInclusive<i32>,
51 | | output: *mut u32,
52 | | offset: u32,
53 | | num_words: usize,
54 | | ) -> usize {
| |__________^
|
call to function `std::arch::x86_64::_mm256_xor_si256` with `#[target_feature]` is unsafe and requires unsafe block:
bitpacker/src/filter_vec/avx2.rs#L22
warning[E0133]: call to function `std::arch::x86_64::_mm256_xor_si256` with `#[target_feature]` is unsafe and requires unsafe block
--> bitpacker/src/filter_vec/avx2.rs:22:5
|
22 | op_xor(vals_u32x8s, HIGHEST_BIT_MASK)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ call to function with `#[target_feature]`
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html>
= help: in order for the call to be safe, the context requires the following additional target feature: avx2
note: an unsafe function restricts its caller, but its body is safe by default
--> bitpacker/src/filter_vec/avx2.rs:20:1
|
20 | unsafe fn u32_to_i32_avx2(vals_u32x8s: DataType) -> DataType {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: `#[warn(unsafe_op_in_unsafe_fn)]` on by default
|