Skip to content

Commit 356d132

Browse files
authored
chore: update clippy suggestions (#3495)
Some new suggestions were adding in 1.85 and they are tripping up CI builds We need to temporarily ignore `useless_conversion` until we're able to upgrade arrow due to rust-lang/rust-clippy#12039 We need to temporarily pin `chrono` until we're able to upgrade arrow due to chronotope/chrono#1666
1 parent 949c6e7 commit 356d132

File tree

8 files changed

+28
-20
lines changed

8 files changed

+28
-20
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ bitvec = "1"
8585
bytes = "1.4"
8686
byteorder = "1.5"
8787
clap = { version = "4", features = ["derive"] }
88-
chrono = { version = "0.4.25", default-features = false, features = [
88+
# Version temporarily pinned to work around unlabeled breaking change
89+
# https://github.com/apache/arrow-rs/commit/2fddf85afcd20110ce783ed5b4cdeb82293da30b
90+
chrono = { version = "=0.4.39", default-features = false, features = [
8991
"std",
9092
"now",
9193
] }

python/Cargo.lock

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
//! automatic versioning, optimized for computer vision, bioinformatics, spatial and ML data.
1919
//! [Apache Arrow](https://arrow.apache.org/) and DuckDB compatible.
2020
21+
// Workaround for https://github.com/rust-lang/rust-clippy/issues/12039
22+
// Remove after upgrading pyo3 to 0.23
23+
#![allow(clippy::useless_conversion)]
24+
2125
use std::env;
2226
use std::sync::Arc;
2327

python/src/scanner.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,10 @@ impl Scanner {
7272
fn analyze_plan(self_: PyRef<'_, Self>) -> PyResult<String> {
7373
let scanner = self_.scanner.clone();
7474
let res = RT
75-
.spawn(Some(self_.py()), async move {
76-
scanner.analyze_plan().await
77-
})?
75+
.spawn(
76+
Some(self_.py()),
77+
async move { scanner.analyze_plan().await },
78+
)?
7879
.map_err(|err| PyValueError::new_err(err.to_string()))?;
7980

8081
Ok(res)

rust/lance-core/src/utils/mask.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,8 @@ impl RowIdTreeMap {
518518
/// * u32: fragment_id
519519
/// * u32: bitmap size
520520
/// * \[u8\]: bitmap
521-
/// If bitmap size is zero then the entire fragment is selected.
521+
///
522+
/// If bitmap size is zero then the entire fragment is selected.
522523
pub fn serialize_into<W: Write>(&self, mut writer: W) -> Result<()> {
523524
writer.write_u32::<byteorder::LittleEndian>(self.inner.len() as u32)?;
524525
for (fragment, set) in &self.inner {

rust/lance-datafusion/src/planner.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ impl Planner {
816816
for i in (start_idx..hex_bytes.len()).step_by(2) {
817817
let high = Self::try_decode_hex_char(hex_bytes[i])?;
818818
let low = Self::try_decode_hex_char(hex_bytes[i + 1])?;
819-
decoded_bytes.push(high << 4 | low);
819+
decoded_bytes.push((high << 4) | low);
820820
}
821821

822822
Some(decoded_bytes)

rust/lance-encoding/src/compression_algo/fsst/src/fsst.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const FSST_HASH_PRIME: u64 = 2971215073;
3838
const FSST_SHIFT: usize = 15;
3939
#[inline]
4040
fn fsst_hash(w: u64) -> u64 {
41-
w.wrapping_mul(FSST_HASH_PRIME) ^ (w.wrapping_mul(FSST_HASH_PRIME)) >> FSST_SHIFT
41+
w.wrapping_mul(FSST_HASH_PRIME) ^ ((w.wrapping_mul(FSST_HASH_PRIME)) >> FSST_SHIFT)
4242
}
4343

4444
const MAX_SYMBOL_LENGTH: usize = 8;
@@ -119,7 +119,7 @@ impl Symbol {
119119
Self {
120120
val: c as u64,
121121
// in a symbol which represents a single character, 56 bits(7 bytes) are ignored, code length is 1
122-
icl: (1 << CODE_LEN_SHIFT_IN_ICL) | (code as u64) << CODE_SHIFT_IN_ICL | 56,
122+
icl: (1 << CODE_LEN_SHIFT_IN_ICL) | ((code as u64) << CODE_SHIFT_IN_ICL) | 56,
123123
}
124124
}
125125

@@ -368,7 +368,7 @@ impl SymbolTable {
368368
return self.byte_codes[input[0] as usize] & FSST_CODE_MASK;
369369
}
370370
if len == 2 {
371-
let short_code = (input[1] as usize) << 8 | input[0] as usize;
371+
let short_code = ((input[1] as usize) << 8) | input[0] as usize;
372372
if self.short_codes[short_code] >= FSST_CODE_BASE {
373373
return self.short_codes[short_code] & FSST_CODE_MASK;
374374
} else {
@@ -1053,9 +1053,9 @@ impl FsstEncoder {
10531053
let st = &self.symbol_table;
10541054

10551055
let st_info: u64 = FSST_MAGIC
1056-
| (self.encoder_switch as u64) << 24
1057-
| ((st.suffix_lim & 255) as u64) << 16
1058-
| ((st.terminator & 255) as u64) << 8
1056+
| ((self.encoder_switch as u64) << 24)
1057+
| (((st.suffix_lim & 255) as u64) << 16)
1058+
| (((st.terminator & 255) as u64) << 8)
10591059
| ((st.n_symbols & 255) as u64);
10601060

10611061
let st_info_bytes = st_info.to_ne_bytes();

0 commit comments

Comments
 (0)