Skip to content

Commit 5e2b4b8

Browse files
authored
chore(query): bump up rust toolchain to 2024-11-28 (#16981)
* update * update * update * update * update * update * update * update
1 parent 9700a3b commit 5e2b4b8

File tree

217 files changed

+1141
-1027
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+1141
-1027
lines changed

.github/actions/check/action.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,12 @@ runs:
4242
taplo check
4343
taplo fmt --check
4444
45-
- name: Audit dependencies
46-
shell: bash
47-
if: "!contains(github.event.head_commit.message, 'skip audit')"
48-
run: cargo audit --db ./target/advisory-db
45+
46+
# TODO: enable it later
47+
# - name: Audit dependencies
48+
# shell: bash
49+
# if: "!contains(github.event.head_commit.message, 'skip audit')"
50+
# run: cargo audit --db ./target/advisory-db
4951

5052
- name: Clippy
5153
shell: bash

Cargo.lock

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

rust-toolchain.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[toolchain]
2-
channel = "nightly-2024-07-02"
2+
channel = "nightly-2024-11-28"
33
components = ["rustfmt", "clippy", "rust-src", "miri", "rust-analyzer"]

rustfmt.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
edition = "2021"
2-
version = "Two"
2+
style_edition = "2021"
33
reorder_imports = true
44
imports_granularity = "Item"
55
group_imports = "StdExternalCrate"
66
where_single_line = true
77
trailing_comma = "Vertical"
88
overflow_delimited_expr = true
99
format_code_in_doc_comments = true
10-
normalize_comments = true
10+
normalize_comments = true

src/common/base/src/base/semaphore.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl Semaphore {
100100
}
101101
}
102102

103-
impl<'a> Drop for SemaphoreGuard<'a> {
103+
impl Drop for SemaphoreGuard<'_> {
104104
fn drop(&mut self) {
105105
self.sem.release();
106106
}

src/common/base/src/base/stoppable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ pub trait Stoppable {
3434
///
3535
/// Calling `stop()` twice should get an error.
3636
async fn stop(&mut self, mut force: Option<broadcast::Receiver<()>>)
37-
-> Result<(), Self::Error>;
37+
-> Result<(), Self::Error>;
3838
}

src/common/base/src/display/display_option/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::fmt;
2020
/// implementation for T.
2121
pub struct DisplayOption<'a, T: fmt::Display>(pub &'a Option<T>);
2222

23-
impl<'a, T: fmt::Display> fmt::Display for DisplayOption<'a, T> {
23+
impl<T: fmt::Display> fmt::Display for DisplayOption<'_, T> {
2424
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2525
match &self.0 {
2626
None => {

src/common/base/src/display/display_slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use std::fmt;
2020
/// - `DisplaySlice(&[1,2,3,4,5,6])` outputs: `"[1,2,3,4,...,6]"`.
2121
pub struct DisplaySlice<'a, T: fmt::Display, const MAX: usize = 5>(pub &'a [T]);
2222

23-
impl<'a, T: fmt::Display, const MAX: usize> fmt::Display for DisplaySlice<'a, T, MAX> {
23+
impl<T: fmt::Display, const MAX: usize> fmt::Display for DisplaySlice<'_, T, MAX> {
2424
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2525
let slice = self.0;
2626
let len = slice.len();

src/common/base/src/runtime/memory/mem_stat.rs

+15-25
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,9 @@ mod tests {
265265
mem_stat.set_limit(MINIMUM_MEMORY_LIMIT);
266266

267267
mem_stat.record_memory::<false>(1, 1).unwrap();
268-
assert!(
269-
mem_stat
270-
.record_memory::<false>(MINIMUM_MEMORY_LIMIT, MINIMUM_MEMORY_LIMIT)
271-
.is_err()
272-
);
268+
assert!(mem_stat
269+
.record_memory::<false>(MINIMUM_MEMORY_LIMIT, MINIMUM_MEMORY_LIMIT)
270+
.is_err());
273271
assert_eq!(
274272
mem_stat.used.load(Ordering::Relaxed),
275273
1 + MINIMUM_MEMORY_LIMIT
@@ -358,11 +356,9 @@ mod tests {
358356
child_mem_stat.set_limit(MINIMUM_MEMORY_LIMIT);
359357

360358
mem_stat.record_memory::<false>(1, 1).unwrap();
361-
assert!(
362-
mem_stat
363-
.record_memory::<false>(MINIMUM_MEMORY_LIMIT, MINIMUM_MEMORY_LIMIT)
364-
.is_ok()
365-
);
359+
assert!(mem_stat
360+
.record_memory::<false>(MINIMUM_MEMORY_LIMIT, MINIMUM_MEMORY_LIMIT)
361+
.is_ok());
366362
assert_eq!(
367363
mem_stat.used.load(Ordering::Relaxed),
368364
1 + MINIMUM_MEMORY_LIMIT
@@ -375,11 +371,9 @@ mod tests {
375371
assert_eq!(child_mem_stat.peak_used.load(Ordering::Relaxed), 0);
376372

377373
child_mem_stat.record_memory::<false>(1, 1).unwrap();
378-
assert!(
379-
child_mem_stat
380-
.record_memory::<false>(MINIMUM_MEMORY_LIMIT, MINIMUM_MEMORY_LIMIT)
381-
.is_err()
382-
);
374+
assert!(child_mem_stat
375+
.record_memory::<false>(MINIMUM_MEMORY_LIMIT, MINIMUM_MEMORY_LIMIT)
376+
.is_err());
383377
assert_eq!(
384378
mem_stat.used.load(Ordering::Relaxed),
385379
1 + MINIMUM_MEMORY_LIMIT + 1 + MINIMUM_MEMORY_LIMIT
@@ -404,11 +398,9 @@ mod tests {
404398
MemStat::create_child("TEST_CHILD".to_string(), vec![mem_stat.clone()]);
405399
child_mem_stat.set_limit(MINIMUM_MEMORY_LIMIT * 2);
406400

407-
assert!(
408-
child_mem_stat
409-
.record_memory::<true>(1 + MINIMUM_MEMORY_LIMIT, 1 + MINIMUM_MEMORY_LIMIT)
410-
.is_err()
411-
);
401+
assert!(child_mem_stat
402+
.record_memory::<true>(1 + MINIMUM_MEMORY_LIMIT, 1 + MINIMUM_MEMORY_LIMIT)
403+
.is_err());
412404
assert_eq!(mem_stat.used.load(Ordering::Relaxed), 0);
413405
assert_eq!(mem_stat.peak_used.load(Ordering::Relaxed), 0);
414406
assert_eq!(child_mem_stat.used.load(Ordering::Relaxed), 0);
@@ -421,11 +413,9 @@ mod tests {
421413
MemStat::create_child("TEST_CHILD".to_string(), vec![mem_stat.clone()]);
422414
child_mem_stat.set_limit(MINIMUM_MEMORY_LIMIT);
423415

424-
assert!(
425-
child_mem_stat
426-
.record_memory::<true>(1 + MINIMUM_MEMORY_LIMIT, 1 + MINIMUM_MEMORY_LIMIT)
427-
.is_err()
428-
);
416+
assert!(child_mem_stat
417+
.record_memory::<true>(1 + MINIMUM_MEMORY_LIMIT, 1 + MINIMUM_MEMORY_LIMIT)
418+
.is_err());
429419
assert_eq!(mem_stat.used.load(Ordering::Relaxed), 0);
430420
// assert_eq!(mem_stat.peak_used.load(Ordering::Relaxed), 0);
431421
assert_eq!(child_mem_stat.used.load(Ordering::Relaxed), 0);

src/common/base/src/runtime/profile/profiles.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ pub static PROFILES_INDEX: OnceCell<
118118
Arc<[Option<ProfileStatisticsName>; std::mem::variant_count::<ProfileStatisticsName>()]>,
119119
> = OnceCell::new();
120120

121-
pub fn get_statistics_name_index()
122-
-> Arc<[Option<ProfileStatisticsName>; std::mem::variant_count::<ProfileStatisticsName>()]> {
121+
pub fn get_statistics_name_index(
122+
) -> Arc<[Option<ProfileStatisticsName>; std::mem::variant_count::<ProfileStatisticsName>()]> {
123123
PROFILES_INDEX
124124
.get_or_init(|| {
125125
let statistics_desc = get_statistics_desc();

src/common/base/tests/it/fixed_heap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn test_is_full() {
149149
#[derive(PartialEq, Eq, PartialOrd, Ord)]
150150
struct DropCounted<'a>(&'a RefCell<usize>);
151151

152-
impl<'a> Drop for DropCounted<'a> {
152+
impl Drop for DropCounted<'_> {
153153
fn drop(&mut self) {
154154
*self.0.borrow_mut() += 1;
155155
}

src/common/base/tests/it/memory/mem_stat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fn test_mem_tracker_with_string_type() {
6262

6363
let str = "".repeat(length);
6464
drop(_guard);
65-
assert_eq!(mem_stat.get_memory_usage(), str.as_bytes().len() as i64);
65+
assert_eq!(mem_stat.get_memory_usage(), str.len() as i64);
6666
}
6767
}
6868

src/common/cache/src/cache/lru.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ impl<'a, K, V> DoubleEndedIterator for Iter<'a, K, V> {
487487
}
488488
}
489489

490-
impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {
490+
impl<K, V> ExactSizeIterator for Iter<'_, K, V> {
491491
fn len(&self) -> usize {
492492
self.0.len()
493493
}
@@ -515,7 +515,7 @@ impl<'a, K, V> DoubleEndedIterator for IterMut<'a, K, V> {
515515
}
516516
}
517517

518-
impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {
518+
impl<K, V> ExactSizeIterator for IterMut<'_, K, V> {
519519
fn len(&self) -> usize {
520520
self.0.len()
521521
}

src/common/cloud_control/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ pub mod task_utils;
2121

2222
#[allow(clippy::derive_partial_eq_without_eq)]
2323
#[allow(clippy::large_enum_variant)]
24-
2524
/// ProtoBuf generated files.
2625
pub mod pb {
2726
// taskproto is proto package name.

src/common/cloud_control/src/task_utils.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub fn format_schedule_options(s: &ScheduleOptions) -> Result<String> {
9292
)));
9393
}
9494
};
95-
return match schedule_type {
95+
match schedule_type {
9696
ScheduleType::IntervalType => {
9797
if s.milliseconds_interval.is_some() {
9898
return Ok(format!(
@@ -119,7 +119,7 @@ pub fn format_schedule_options(s: &ScheduleOptions) -> Result<String> {
119119
}
120120
Ok(res)
121121
}
122-
};
122+
}
123123
}
124124

125125
// convert from crate::pb::task to struct task

src/common/column/src/binary/mod.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,13 @@ impl BinaryColumn {
7474

7575
pub fn index(&self, index: usize) -> Option<&[u8]> {
7676
if index + 1 < self.offsets.len() {
77-
Some(&self.data[(self.offsets[index] as usize)..(self.offsets[index + 1] as usize)])
77+
Some(self.value(index))
7878
} else {
7979
None
8080
}
8181
}
8282

8383
pub fn value(&self, index: usize) -> &[u8] {
84-
assert!(index + 1 < self.offsets.len());
8584
&self.data[(self.offsets[index] as usize)..(self.offsets[index + 1] as usize)]
8685
}
8786

@@ -92,7 +91,13 @@ impl BinaryColumn {
9291
pub unsafe fn index_unchecked(&self, index: usize) -> &[u8] {
9392
let start = *self.offsets.get_unchecked(index) as usize;
9493
let end = *self.offsets.get_unchecked(index + 1) as usize;
95-
self.data.get_unchecked(start..end)
94+
// here we use checked slice to avoid UB
95+
// Less regressed perfs:
96+
// bench_kernels/binary_sum_len_unchecked/20
97+
// time: [45.234 µs 45.278 µs 45.312 µs]
98+
// change: [+1.4430% +1.5796% +1.7344%] (p = 0.00 < 0.05)
99+
// Performance has regressed.
100+
&self.data[start..end]
96101
}
97102

98103
pub fn slice(&self, range: Range<usize>) -> Self {
@@ -113,7 +118,7 @@ impl BinaryColumn {
113118
pub fn option_iter<'a>(
114119
&'a self,
115120
validity: Option<&'a Bitmap>,
116-
) -> ZipValidity<&'a [u8], BinaryColumnIter, BitmapIter<'a>> {
121+
) -> ZipValidity<&'a [u8], BinaryColumnIter<'a>, BitmapIter<'a>> {
117122
let bitmap_iter = validity.as_ref().map(|v| v.iter());
118123
ZipValidity::new(self.iter(), bitmap_iter)
119124
}

src/common/column/src/binview/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ impl<T: ViewType + ?Sized> BinaryViewColumnGeneric<T> {
269269
pub fn option_iter<'a>(
270270
&'a self,
271271
validity: Option<&'a Bitmap>,
272-
) -> ZipValidity<&'a T, BinaryViewColumnIter<T>, BitmapIter<'a>> {
272+
) -> ZipValidity<&'a T, BinaryViewColumnIter<'a, T>, BitmapIter<'a>> {
273273
let bitmap_iter = validity.as_ref().map(|v| v.iter());
274274
ZipValidity::new(self.iter(), bitmap_iter)
275275
}

src/common/column/src/bitmap/bitmap_ops.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -247,23 +247,23 @@ impl PartialEq for Bitmap {
247247
}
248248
}
249249

250-
impl<'a, 'b> BitOr<&'b Bitmap> for &'a Bitmap {
250+
impl<'b> BitOr<&'b Bitmap> for &Bitmap {
251251
type Output = Bitmap;
252252

253253
fn bitor(self, rhs: &'b Bitmap) -> Bitmap {
254254
or(self, rhs)
255255
}
256256
}
257257

258-
impl<'a, 'b> BitAnd<&'b Bitmap> for &'a Bitmap {
258+
impl<'b> BitAnd<&'b Bitmap> for &Bitmap {
259259
type Output = Bitmap;
260260

261261
fn bitand(self, rhs: &'b Bitmap) -> Bitmap {
262262
and(self, rhs)
263263
}
264264
}
265265

266-
impl<'a, 'b> BitXor<&'b Bitmap> for &'a Bitmap {
266+
impl<'b> BitXor<&'b Bitmap> for &Bitmap {
267267
type Output = Bitmap;
268268

269269
fn bitxor(self, rhs: &'b Bitmap) -> Bitmap {

src/common/column/src/bitmap/immutable.rs

-1
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ impl Bitmap {
484484
/// Create a new [`Bitmap`] from an arrow [`NullBuffer`]
485485
///
486486
/// [`NullBuffer`]: arrow_buffer::buffer::NullBuffer
487-
488487
pub fn from_null_buffer(value: arrow_buffer::buffer::NullBuffer) -> Self {
489488
let offset = value.offset();
490489
let length = value.len();

src/common/column/src/bitmap/iterator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'a> TrueIdxIter<'a> {
5050
}
5151
}
5252

53-
impl<'a> Iterator for TrueIdxIter<'a> {
53+
impl Iterator for TrueIdxIter<'_> {
5454
type Item = usize;
5555

5656
#[inline]
@@ -85,7 +85,7 @@ impl<'a> Iterator for TrueIdxIter<'a> {
8585
}
8686
}
8787

88-
unsafe impl<'a> TrustedLen for TrueIdxIter<'a> {}
88+
unsafe impl TrustedLen for TrueIdxIter<'_> {}
8989

9090
/// This crates' equivalent of [`std::vec::IntoIter`] for [`Bitmap`].
9191
#[derive(Debug, Clone)]

src/common/column/src/bitmap/utils/iterator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<'a> BitmapIter<'a> {
4848
}
4949
}
5050

51-
impl<'a> Iterator for BitmapIter<'a> {
51+
impl Iterator for BitmapIter<'_> {
5252
type Item = bool;
5353

5454
#[inline]
@@ -81,7 +81,7 @@ impl<'a> Iterator for BitmapIter<'a> {
8181
}
8282
}
8383

84-
impl<'a> DoubleEndedIterator for BitmapIter<'a> {
84+
impl DoubleEndedIterator for BitmapIter<'_> {
8585
#[inline]
8686
fn next_back(&mut self) -> Option<bool> {
8787
if self.index == self.end {

src/common/column/src/bitmap/utils/slice_iterator.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl<'a> SlicesIterator<'a> {
8888
}
8989
}
9090

91-
impl<'a> Iterator for SlicesIterator<'a> {
91+
impl Iterator for SlicesIterator<'_> {
9292
type Item = (usize, usize);
9393

9494
#[inline]

src/common/column/tests/it/bitmap/utils/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use databend_common_column::bitmap::utils::fmt;
1717

1818
struct A<'a>(&'a [u8], usize, usize);
1919

20-
impl<'a> std::fmt::Debug for A<'a> {
20+
impl std::fmt::Debug for A<'_> {
2121
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
2222
fmt(self.0, self.1, self.2, f)
2323
}

src/common/column/tests/it/bitmap/utils/iterator.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ fn rev() {
5151
let result = iter.rev().collect::<Vec<_>>();
5252
assert_eq!(
5353
result,
54-
vec![
55-
false, true, true, false, true, false, true, true, false, true, true, false, true
56-
]
57-
.into_iter()
58-
.rev()
59-
.collect::<Vec<_>>()
54+
vec![false, true, true, false, true, false, true, true, false, true, true, false, true]
55+
.into_iter()
56+
.rev()
57+
.collect::<Vec<_>>()
6058
)
6159
}

src/common/exception/src/exception_into.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ impl From<tonic::Status> for ErrorCode {
353353
tonic::Code::Unknown => {
354354
let details = status.details();
355355
if details.is_empty() {
356-
if status.source().map_or(false, |e| e.is::<hyper::Error>()) {
356+
if status.source().is_some_and(|e| e.is::<hyper::Error>()) {
357357
return ErrorCode::CannotConnectNode(format!(
358358
"{}, source: {:?}",
359359
status.message(),

0 commit comments

Comments
 (0)