diff --git a/Cargo.lock b/Cargo.lock index e2f32f70809b6..bb136caab6714 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7628,14 +7628,6 @@ dependencies = [ "tracing-subscriber", ] -[[package]] -name = "lru" -version = "0.7.6" -source = "git+https://github.com/risingwavelabs/lru-rs.git?rev=2682b85#2682b855ff04128ed50ae44dfdac25b83c7f790a" -dependencies = [ - "hashbrown 0.14.5", -] - [[package]] name = "lru" version = "0.14.0" @@ -8226,7 +8218,7 @@ dependencies = [ "futures-sink", "futures-util", "keyed_priority_queue", - "lru 0.14.0", + "lru", "mysql_common", "native-tls", "pem", @@ -11324,6 +11316,7 @@ dependencies = [ "foyer", "futures", "governor", + "hashbrown 0.14.5", "hashbrown 0.16.0", "hex", "http 1.3.1", @@ -11336,7 +11329,7 @@ dependencies = [ "jsonbb", "libc", "linkme", - "lru 0.7.6", + "lru", "mach2", "madsim-tokio", "memcomparable", @@ -12539,7 +12532,7 @@ dependencies = [ "either", "futures", "http 1.3.1", - "lru 0.7.6", + "lru", "madsim-tokio", "madsim-tonic", "moka", @@ -12606,7 +12599,7 @@ dependencies = [ "futures", "glob", "itertools 0.14.0", - "lru 0.7.6", + "lru", "madsim", "madsim-rdkafka", "madsim-tokio", @@ -12818,7 +12811,7 @@ dependencies = [ "iceberg", "itertools 0.14.0", "jsonbb", - "lru 0.7.6", + "lru", "madsim-tokio", "madsim-tonic", "maplit", diff --git a/Cargo.toml b/Cargo.toml index e283608f080f4..6e7c5eab32625 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -162,6 +162,9 @@ hashbrown = { version = "0.16", features = [ "inline-more", "nightly", ] } +hashbrown0_14 = { package = "hashbrown", version = "0.14", features = [ + "nightly", +] } hytra = "0.1" # branch dev_rebase_main_20250325 iceberg = { git = "https://github.com/risingwavelabs/iceberg-rust.git", rev = "8c4a29f2f6ed6f713ffb4b0406cd49c52e0efb6f", features = [ @@ -177,7 +180,7 @@ itertools = "0.14.0" jni = { version = "0.21.1", features = ["invocation"] } jsonbb = "0.1.4" linkme = { version = "0.3.32", features = ["used_linker"] } -lru = { git = "https://github.com/risingwavelabs/lru-rs.git", rev = "2682b85" } +lru = "0.14" madsim = "0.2.34" mixtrics = { version = "0.2", features = ["prometheus"] } mysql_async = { version = "0.36", features = ["native-tls-tls", "rust_decimal"] } @@ -322,10 +325,12 @@ new_without_default = "allow" # TODO: remove later https://github.com/rust-lang/rust-clippy/issues/12537 # duplicated_attributes = "allow" # TODO: remove later https://github.com/rust-lang/rust-clippy/issues/12436 -mixed_attributes_style = "allow" +#mixed_attributes_style = "allow" too_long_first_doc_paragraph = "allow" +# TODO: remove later when EnumAsInner, bitfield and EnumTryAs does not fire this warning +double_parens = "allow" str_to_string = "warn" -string_to_string = "warn" +implicit_clone = "warn" # TODO: this makes sense, but it's too noisy for now (2025-03-10) large_enum_variant = "allow" diff --git a/ci/.env b/ci/.env index d4ae4c28c6fbe..0a5953be75078 100644 --- a/ci/.env +++ b/ci/.env @@ -1 +1 @@ -BUILD_ENV_VERSION=v20250923 +BUILD_ENV_VERSION=v20251015 diff --git a/ci/rust-toolchain b/ci/rust-toolchain index 3a11eb6177ad4..e7d5d446d2251 100644 --- a/ci/rust-toolchain +++ b/ci/rust-toolchain @@ -4,4 +4,4 @@ # 3. (optional) **follow the instructions in `lints/README.md`** to update the toolchain and dependencies for lints [toolchain] -channel = "nightly-2025-06-25" +channel = "nightly-2025-10-10" diff --git a/lints/Cargo.lock b/lints/Cargo.lock index bc05e056b0f6b..753a0f5fc1c19 100644 --- a/lints/Cargo.lock +++ b/lints/Cargo.lock @@ -162,8 +162,8 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clippy_utils" -version = "0.1.89" -source = "git+https://github.com/risingwavelabs/clippy?rev=ff5af2fc22b4bb813fc7af028f99f58ecea22cd4#ff5af2fc22b4bb813fc7af028f99f58ecea22cd4" +version = "0.1.92" +source = "git+https://github.com/risingwavelabs/clippy?rev=0b9b812ddd1b49a581ae865afde73e7d6365eb8c#0b9b812ddd1b49a581ae865afde73e7d6365eb8c" dependencies = [ "arrayvec", "itertools 0.12.0", diff --git a/lints/Cargo.toml b/lints/Cargo.toml index f1aea1f0645c0..c2ecfbc69a32e 100644 --- a/lints/Cargo.toml +++ b/lints/Cargo.toml @@ -14,7 +14,7 @@ path = "ui/format_error.rs" # See `README.md` before bumping the version. # Remember to update the version in `ci/Dockerfile` as well. [dependencies] -clippy_utils = { git = "https://github.com/risingwavelabs/clippy", rev="ff5af2fc22b4bb813fc7af028f99f58ecea22cd4" } +clippy_utils = { git = "https://github.com/risingwavelabs/clippy", rev="0b9b812ddd1b49a581ae865afde73e7d6365eb8c" } dylint_linting = "=4.1.0" itertools = "0.14" diff --git a/lints/rust-toolchain b/lints/rust-toolchain index 3afabd5dd549f..e99971ed827dc 100644 --- a/lints/rust-toolchain +++ b/lints/rust-toolchain @@ -1,5 +1,5 @@ # See `README.md` before bumping the version. [toolchain] -channel = "nightly-2025-06-25" +channel = "nightly-2025-10-10" components = ["llvm-tools-preview", "rustc-dev"] diff --git a/lints/src/lib.rs b/lints/src/lib.rs index 213860e9aaf81..1effaac49a4cd 100644 --- a/lints/src/lib.rs +++ b/lints/src/lib.rs @@ -13,7 +13,7 @@ // limitations under the License. #![feature(rustc_private)] -#![feature(let_chains)] + #![warn(unused_extern_crates)] extern crate rustc_ast; diff --git a/lints/src/utils/format_args_collector.rs b/lints/src/utils/format_args_collector.rs index 64729ba00ca24..ff204c9a7d279 100644 --- a/lints/src/utils/format_args_collector.rs +++ b/lints/src/utils/format_args_collector.rs @@ -22,7 +22,7 @@ use clippy_utils::source::snippet_opt; use itertools::Itertools; use rustc_ast::{Crate, Expr, ExprKind, FormatArgs}; use rustc_data_structures::fx::FxHashMap; -use rustc_lexer::{TokenKind, tokenize}; +use rustc_lexer::{FrontmatterAllowed, TokenKind, tokenize}; use rustc_lint::{EarlyContext, EarlyLintPass}; use rustc_session::impl_lint_pass; use rustc_span::{Span, hygiene}; @@ -104,7 +104,7 @@ fn has_span_from_proc_macro(cx: &EarlyContext<'_>, args: &FormatArgs) -> bool { let Some(snippet) = snippet_opt(cx, between_span) else { return true; }; - for token in tokenize(&snippet) { + for token in tokenize(&snippet, FrontmatterAllowed::No) { match token.kind { TokenKind::LineComment { .. } | TokenKind::BlockComment { .. } diff --git a/src/batch/executors/benches/hash_agg.rs b/src/batch/executors/benches/hash_agg.rs index 3b0d6252960f8..85c9210a001c4 100644 --- a/src/batch/executors/benches/hash_agg.rs +++ b/src/batch/executors/benches/hash_agg.rs @@ -73,7 +73,7 @@ fn create_hash_agg_executor( ); let input_schema = input.schema(); - let agg_calls = vec![create_agg_call( + let agg_calls = [create_agg_call( input_schema, agg_type, arg_columns, diff --git a/src/batch/executors/src/executor/generic_exchange.rs b/src/batch/executors/src/executor/generic_exchange.rs index 4d3cca1b0473c..fb57bb5891dc1 100644 --- a/src/batch/executors/src/executor/generic_exchange.rs +++ b/src/batch/executors/src/executor/generic_exchange.rs @@ -162,11 +162,11 @@ impl BoxedExecutorBuilder for GenericExchangeExecutorBuilder { let sequential = node.get_sequential(); ensure!(!node.get_sources().is_empty()); - let proto_sources: Vec = node.get_sources().to_vec(); + let proto_sources: Vec = node.get_sources().clone(); let source_creators = vec![DefaultCreateSource::new(source.context().client_pool()); proto_sources.len()]; - let input_schema: Vec = node.get_input_schema().to_vec(); + let input_schema: Vec = node.get_input_schema().clone(); let fields = input_schema.iter().map(Field::from).collect::>(); Ok(Box::new(ExchangeExecutor { proto_sources, diff --git a/src/batch/executors/src/executor/join/distributed_lookup_join.rs b/src/batch/executors/src/executor/join/distributed_lookup_join.rs index b384cbab40525..367b7e22826f2 100644 --- a/src/batch/executors/src/executor/join/distributed_lookup_join.rs +++ b/src/batch/executors/src/executor/join/distributed_lookup_join.rs @@ -108,7 +108,7 @@ impl BoxedExecutorBuilder for DistributedLookupJoinExecutorBuilder { let table_desc = distributed_lookup_join_node.get_inner_side_table_desc()?; let inner_side_column_ids = distributed_lookup_join_node .get_inner_side_column_ids() - .to_vec(); + .clone(); let inner_side_schema = Schema { fields: inner_side_column_ids @@ -163,7 +163,7 @@ impl BoxedExecutorBuilder for DistributedLookupJoinExecutorBuilder { .map(|&i| inner_side_schema.fields[i].data_type.clone()) .collect_vec(); - let null_safe = distributed_lookup_join_node.get_null_safe().to_vec(); + let null_safe = distributed_lookup_join_node.get_null_safe().clone(); let chunk_size = source.context().get_config().developer.chunk_size; diff --git a/src/batch/executors/src/executor/join/local_lookup_join.rs b/src/batch/executors/src/executor/join/local_lookup_join.rs index 5ab369330fe71..f072c7660eafd 100644 --- a/src/batch/executors/src/executor/join/local_lookup_join.rs +++ b/src/batch/executors/src/executor/join/local_lookup_join.rs @@ -308,7 +308,7 @@ impl BoxedExecutorBuilder for LocalLookupJoinExecutorBuilder { let outer_side_data_types = outer_side_input.schema().data_types(); let table_desc = lookup_join_node.get_inner_side_table_desc()?; - let inner_side_column_ids = lookup_join_node.get_inner_side_column_ids().to_vec(); + let inner_side_column_ids = lookup_join_node.get_inner_side_column_ids().clone(); let inner_side_schema = Schema { fields: inner_side_column_ids @@ -362,7 +362,7 @@ impl BoxedExecutorBuilder for LocalLookupJoinExecutorBuilder { .map(|&i| inner_side_schema.fields[i].data_type.clone()) .collect_vec(); - let null_safe = lookup_join_node.get_null_safe().to_vec(); + let null_safe = lookup_join_node.get_null_safe().clone(); let vnode_mapping = lookup_join_node .get_inner_side_vnode_mapping() diff --git a/src/batch/executors/src/executor/merge_sort_exchange.rs b/src/batch/executors/src/executor/merge_sort_exchange.rs index 27b4a7a7494a7..96c0d27704264 100644 --- a/src/batch/executors/src/executor/merge_sort_exchange.rs +++ b/src/batch/executors/src/executor/merge_sort_exchange.rs @@ -146,7 +146,7 @@ impl BoxedExecutorBuilder for MergeSortExchangeExecutorBuilder { let column_orders = Arc::new(column_orders); let exchange_node = sort_merge_node.get_exchange()?; - let proto_sources: Vec = exchange_node.get_sources().to_vec(); + let proto_sources: Vec = exchange_node.get_sources().clone(); let source_creators = vec![DefaultCreateSource::new(source.context().client_pool()); proto_sources.len()]; ensure!(!exchange_node.get_sources().is_empty()); diff --git a/src/batch/executors/src/lib.rs b/src/batch/executors/src/lib.rs index 01f80dc61ca11..30782070cd3d2 100644 --- a/src/batch/executors/src/lib.rs +++ b/src/batch/executors/src/lib.rs @@ -29,7 +29,6 @@ #![feature(proc_macro_hygiene, stmt_expr_attributes)] #![feature(iterator_try_collect)] #![recursion_limit = "256"] -#![feature(let_chains)] #![feature(int_roundings)] #![feature(allocator_api)] #![feature(impl_trait_in_assoc_type)] diff --git a/src/batch/src/lib.rs b/src/batch/src/lib.rs index 6dab71c64c4b2..0241aa9635e55 100644 --- a/src/batch/src/lib.rs +++ b/src/batch/src/lib.rs @@ -21,7 +21,6 @@ #![feature(proc_macro_hygiene, stmt_expr_attributes)] #![feature(iterator_try_collect)] #![recursion_limit = "256"] -#![feature(let_chains)] #![feature(int_roundings)] #![feature(allocator_api)] #![feature(impl_trait_in_assoc_type)] diff --git a/src/bench/sink_bench/main.rs b/src/bench/sink_bench/main.rs index 28d95c8c143d8..5d3155ec3e549 100644 --- a/src/bench/sink_bench/main.rs +++ b/src/bench/sink_bench/main.rs @@ -14,7 +14,6 @@ #![feature(coroutines)] #![feature(proc_macro_hygiene)] #![feature(stmt_expr_attributes)] -#![feature(let_chains)] #![recursion_limit = "256"] use core::str::FromStr; diff --git a/src/cmd_all/src/lib.rs b/src/cmd_all/src/lib.rs index c73dbbabb3816..b86ae7adcf2be 100644 --- a/src/cmd_all/src/lib.rs +++ b/src/cmd_all/src/lib.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] - mod common; mod standalone; diff --git a/src/common/Cargo.toml b/src/common/Cargo.toml index 7b108a656f9c5..a41f79248b0be 100644 --- a/src/common/Cargo.toml +++ b/src/common/Cargo.toml @@ -46,6 +46,7 @@ foyer = { workspace = true } futures = { version = "0.3", default-features = false, features = ["alloc"] } governor = { workspace = true } hashbrown = { workspace = true } +hashbrown0_14 = { workspace = true } hex = "0.4.3" http = "1" humantime = "2.2" diff --git a/src/common/benches/bench_lru.rs b/src/common/benches/bench_lru.rs index a7b5adf4675a8..90537e73b880b 100644 --- a/src/common/benches/bench_lru.rs +++ b/src/common/benches/bench_lru.rs @@ -21,17 +21,19 @@ use lru::LruCache; use risingwave_common::lru::LruCache as RwLruCache; use risingwave_common::sequence::SEQUENCE_GLOBAL; -fn lru(loops: usize, evict_ratio: u64) -> (usize, Duration) { +fn lru(loops: usize, _evict_ratio: u64) -> (usize, Duration) { let mut lru = LruCache::unbounded(); - let mut evicted = 0; + let evicted = 0; let now = Instant::now(); for i in 0..loops as u64 { - if i % evict_ratio == 0 && i != 0 { - lru.update_epoch(i); - while lru.pop_lru_by_epoch(i).is_some() { - evicted += 1; - } - } + // Changed back to use the official lru-rs crate, so there is no update_epoch anymore. + // Keep the code for reference. + // if i % evict_ratio == 0 && i != 0 { + // lru.update_epoch(i); + // while lru.pop_lru_by_epoch(i).is_some() { + // evicted += 1; + // } + // } lru.put(i, i); } diff --git a/src/common/benches/bench_sequencer.rs b/src/common/benches/bench_sequencer.rs index e99a8d5457a12..4737fb42fe649 100644 --- a/src/common/benches/bench_sequencer.rs +++ b/src/common/benches/bench_sequencer.rs @@ -63,7 +63,7 @@ fn atomic_skip(loops: usize, atomic: Arc, skip: usize) -> Duration for _ in 0..loops { cnt += 1; let _ = cnt; - if cnt % skip == 0 { + if cnt.is_multiple_of(skip) { let _ = atomic.fetch_add(skip, Ordering::Relaxed); } else { let _ = atomic.load(Ordering::Relaxed); diff --git a/src/common/estimate_size/src/lib.rs b/src/common/estimate_size/src/lib.rs index f8ee226e91143..62812b9e2c23e 100644 --- a/src/common/estimate_size/src/lib.rs +++ b/src/common/estimate_size/src/lib.rs @@ -14,7 +14,6 @@ #![feature(allocator_api)] #![feature(btree_cursors)] -#![feature(btree_extract_if)] pub mod collections; diff --git a/src/common/src/array/struct_array.rs b/src/common/src/array/struct_array.rs index 900c635c378f7..381becdac710b 100644 --- a/src/common/src/array/struct_array.rs +++ b/src/common/src/array/struct_array.rs @@ -837,7 +837,7 @@ mod tests { let mut builder = StructArrayBuilder::with_type( 0, - DataType::Struct(StructType::unnamed(fields.to_vec())), + DataType::Struct(StructType::unnamed(fields.clone())), ); builder.append(Some(StructRef::ValueRef { val: &lhs })); builder.append(Some(StructRef::ValueRef { val: &rhs })); diff --git a/src/common/src/bitmap.rs b/src/common/src/bitmap.rs index db095f4b4887e..4b3f5eafa4c4f 100644 --- a/src/common/src/bitmap.rs +++ b/src/common/src/bitmap.rs @@ -90,7 +90,7 @@ impl BitmapBuilder { pub fn filled(len: usize) -> BitmapBuilder { let vec_len = Bitmap::vec_len(len); let mut data = vec![usize::MAX; vec_len]; - if vec_len >= 1 && len % BITS != 0 { + if vec_len >= 1 && !len.is_multiple_of(BITS) { data[vec_len - 1] = (1 << (len % BITS)) - 1; } BitmapBuilder { len, data } @@ -119,7 +119,7 @@ impl BitmapBuilder { /// Appends a single bit to the back. pub fn append(&mut self, bit_set: bool) -> &mut Self { - if self.len % BITS == 0 { + if self.len.is_multiple_of(BITS) { self.data.push(0); } self.data[self.len / BITS] |= (bit_set as usize) << (self.len % BITS); @@ -129,7 +129,7 @@ impl BitmapBuilder { /// Appends `n` bits to the back. pub fn append_n(&mut self, mut n: usize, bit_set: bool) -> &mut Self { - while n != 0 && self.len % BITS != 0 { + while n != 0 && !self.len.is_multiple_of(BITS) { self.append(bit_set); n -= 1; } @@ -138,7 +138,7 @@ impl BitmapBuilder { Bitmap::vec_len(self.len), if bit_set { usize::MAX } else { 0 }, ); - if bit_set && self.len % BITS != 0 { + if bit_set && !self.len.is_multiple_of(BITS) { // remove tailing 1s *self.data.last_mut().unwrap() &= (1 << (self.len % BITS)) - 1; } @@ -152,7 +152,7 @@ impl BitmapBuilder { } self.len -= 1; self.data.truncate(Bitmap::vec_len(self.len)); - if self.len % BITS != 0 { + if !self.len.is_multiple_of(BITS) { *self.data.last_mut().unwrap() &= (1 << (self.len % BITS)) - 1; } Some(()) @@ -160,7 +160,7 @@ impl BitmapBuilder { /// Appends a bitmap to the back. pub fn append_bitmap(&mut self, other: &Bitmap) -> &mut Self { - if self.len % BITS == 0 { + if self.len.is_multiple_of(BITS) { // fast path: self is aligned self.len += other.len(); if let Some(bits) = &other.bits { @@ -172,7 +172,7 @@ impl BitmapBuilder { } else { // append 1s self.data.resize(Bitmap::vec_len(self.len), usize::MAX); - if self.len % BITS != 0 { + if !self.len.is_multiple_of(BITS) { // remove tailing 1s *self.data.last_mut().unwrap() = (1 << (self.len % BITS)) - 1; } @@ -305,16 +305,18 @@ impl Bitmap { /// Creates a new bitmap from a slice of `bool`. pub fn from_bool_slice(bools: &[bool]) -> Self { // use SIMD to speed up - let mut iter = bools.array_chunks::(); + let mut iter = bools.iter().copied().array_chunks::(); let mut bits = Vec::with_capacity(Self::vec_len(bools.len())); for chunk in iter.by_ref() { - let bitmask = std::simd::Mask::::from_array(*chunk).to_bitmask() as usize; + let bitmask = std::simd::Mask::::from_array(chunk).to_bitmask() as usize; bits.push(bitmask); } - if !iter.remainder().is_empty() { + if let Some(remainder_iter) = iter.into_remainder() + && !remainder_iter.is_empty() + { let mut bitmask = 0; - for (i, b) in iter.remainder().iter().enumerate() { - bitmask |= (*b as usize) << i; + for (i, b) in remainder_iter.enumerate() { + bitmask |= (b as usize) << i; } bits.push(bitmask); } @@ -624,7 +626,7 @@ impl Not for &Bitmap { Some(bits) => bits, }; let mut bits: Box<[usize]> = bits.iter().map(|b| !b).collect(); - if self.num_bits % BITS != 0 { + if !self.num_bits.is_multiple_of(BITS) { bits[self.num_bits / BITS] &= (1 << (self.num_bits % BITS)) - 1; } Bitmap { @@ -645,7 +647,7 @@ impl Not for Bitmap { Some(bits) => bits, }; bits.iter_mut().for_each(|x| *x = !*x); - if self.num_bits % BITS != 0 { + if !self.num_bits.is_multiple_of(BITS) { bits[self.num_bits / BITS] &= (1 << (self.num_bits % BITS)) - 1; } self.count_ones = self.num_bits - self.count_ones; @@ -675,7 +677,7 @@ impl Bitmap { None if self.count_ones == 0 => body.resize(body_len, 0), None => { body.resize(body_len, u8::MAX); - if self.num_bits % 8 != 0 { + if !self.num_bits.is_multiple_of(8) { body[body_len - 1] = (1 << (self.num_bits % 8)) - 1; } } diff --git a/src/common/src/cache.rs b/src/common/src/cache.rs index 83f7f5330705a..a4aa0bb70f506 100644 --- a/src/common/src/cache.rs +++ b/src/common/src/cache.rs @@ -945,19 +945,15 @@ impl Drop for CleanCacheGuar /// `lookup_with_request_dedup` which will return a `LookupResponse` which contains /// `Receiver>` or `JoinHandle, E>>` when cache hit /// does not happen. +#[derive(Default)] pub enum LookupResponse { + #[default] Invalid, Cached(CacheableEntry), WaitPendingRequest(Receiver>), Miss(JoinHandle, E>>), } -impl Default for LookupResponse { - fn default() -> Self { - Self::Invalid - } -} - impl> Future for LookupResponse { diff --git a/src/common/src/cast/mod.rs b/src/common/src/cast/mod.rs index 52e224d33baaf..f36cba0477959 100644 --- a/src/common/src/cast/mod.rs +++ b/src/common/src/cast/mod.rs @@ -22,7 +22,7 @@ pub const PARSE_ERROR_STR_TO_BYTEA: &str = "Invalid Bytea syntax"; /// Parse a string into a bool. /// -/// See [`https://www.postgresql.org/docs/9.5/datatype-boolean.html`] +/// See `https://www.postgresql.org/docs/9.5/datatype-boolean.html` pub fn str_to_bool(input: &str) -> Result { /// String literals for bool type. const TRUE_BOOL_LITERALS: [&str; 9] = ["true", "tru", "tr", "t", "on", "1", "yes", "ye", "y"]; diff --git a/src/common/src/catalog/mod.rs b/src/common/src/catalog/mod.rs index 974e3697caa9c..1788a0c509e45 100644 --- a/src/common/src/catalog/mod.rs +++ b/src/common/src/catalog/mod.rs @@ -581,18 +581,13 @@ impl StreamJobStatus { } } -#[derive(Clone, Copy, Debug, Display, Hash, PartialOrd, PartialEq, Eq, Ord)] +#[derive(Clone, Copy, Debug, Display, Hash, PartialOrd, PartialEq, Eq, Ord, Default)] pub enum CreateType { + #[default] Foreground, Background, } -impl Default for CreateType { - fn default() -> Self { - Self::Foreground - } -} - impl CreateType { pub fn from_proto(pb_create_type: PbCreateType) -> Self { match pb_create_type { diff --git a/src/common/src/hash/consistent_hash/bitmap.rs b/src/common/src/hash/consistent_hash/bitmap.rs index 4351eaff9912c..94086363b4af8 100644 --- a/src/common/src/hash/consistent_hash/bitmap.rs +++ b/src/common/src/hash/consistent_hash/bitmap.rs @@ -36,7 +36,7 @@ impl Bitmap { /// the bitmap. pub fn vnode_ranges(&self) -> impl Iterator> + '_ { self.high_ranges() - .map(|r| (VirtualNode::from_index(*r.start())..=VirtualNode::from_index(*r.end()))) + .map(|r| VirtualNode::from_index(*r.start())..=VirtualNode::from_index(*r.end())) } /// Returns whether only the [`SINGLETON_VNODE`] is set in the bitmap. diff --git a/src/common/src/lib.rs b/src/common/src/lib.rs index eb9b8c37d345c..0689a7ad425dd 100644 --- a/src/common/src/lib.rs +++ b/src/common/src/lib.rs @@ -24,9 +24,7 @@ #![feature(coroutines)] #![feature(map_try_insert)] #![feature(error_generic_member_access)] -#![feature(let_chains)] #![feature(portable_simd)] -#![feature(array_chunks)] #![feature(once_cell_try)] #![allow(incomplete_features)] #![feature(iterator_try_collect)] @@ -41,6 +39,8 @@ #![feature(vec_into_raw_parts)] #![feature(exact_div)] #![feature(used_with_arg)] +#![feature(iter_array_chunks)] +#![feature(exact_size_is_empty)] #![register_tool(rw)] #[cfg_attr(not(test), allow(unused_extern_crates))] diff --git a/src/common/src/lru.rs b/src/common/src/lru.rs index 0c96b0d2570b9..c2094dc1a0b08 100644 --- a/src/common/src/lru.rs +++ b/src/common/src/lru.rs @@ -23,6 +23,7 @@ use std::sync::atomic::Ordering; pub use ahash::RandomState; use hashbrown::HashTable; use hashbrown::hash_table::Entry; +use hashbrown0_14 as _; use crate::sequence::{AtomicSequence, Sequence, Sequencer}; @@ -167,7 +168,7 @@ where }, self.alloc.clone(), ); - let ptr = NonNull::new_unchecked(Box::into_raw(entry)); + let ptr = NonNull::new_unchecked(Box::into_raw_with_allocator(entry).0); v.insert(ptr); self.attach(ptr); None diff --git a/src/common/src/telemetry/report.rs b/src/common/src/telemetry/report.rs index 85ed83f6a16dc..e18cbae4317e1 100644 --- a/src/common/src/telemetry/report.rs +++ b/src/common/src/telemetry/report.rs @@ -157,8 +157,7 @@ where } }; - let url = - (TELEMETRY_REPORT_URL.to_owned() + "/" + report_creator.report_type()).to_owned(); + let url = TELEMETRY_REPORT_URL.to_owned() + "/" + report_creator.report_type(); match post_telemetry_report_pb(&url, bin_report).await { Ok(_) => tracing::info!("Telemetry post success, id {}", tracking_id), diff --git a/src/common/src/types/num256.rs b/src/common/src/types/num256.rs index cc5e2148ed04b..d6d9a508e7da1 100644 --- a/src/common/src/types/num256.rs +++ b/src/common/src/types/num256.rs @@ -346,7 +346,7 @@ mod tests { ($t:ty, $lhs:expr, $rhs:expr, [$($f:ident),+]) => { $(assert_eq!( Int256::from($lhs as $t).$f(&Int256::from($rhs as $t)), - ($lhs as $t).$f(($rhs as $t)).map(Int256::from) + ($lhs as $t).$f($rhs as $t).map(Int256::from) );)+ }; } diff --git a/src/common/src/util/epoch.rs b/src/common/src/util/epoch.rs index 4b3bb145f42d8..5f1df15391c73 100644 --- a/src/common/src/util/epoch.rs +++ b/src/common/src/util/epoch.rs @@ -129,8 +129,7 @@ pub const MAX_SPILL_TIMES: u16 = ((1 << EPOCH_AVAILABLE_BITS) - 1) as u16; // Low EPOCH_AVAILABLE_BITS bits set to 1 pub const EPOCH_SPILL_TIME_MASK: u64 = (1 << EPOCH_AVAILABLE_BITS) - 1; // High (64-EPOCH_AVAILABLE_BITS) bits set to 1 -const EPOCH_MASK: u64 = !EPOCH_SPILL_TIME_MASK; -pub const MAX_EPOCH: u64 = u64::MAX & EPOCH_MASK; +pub const MAX_EPOCH: u64 = !((1 << EPOCH_AVAILABLE_BITS) - 1); // EPOCH_INC_MIN_STEP_FOR_TEST is the minimum increment step for epoch in unit tests. // We need to keep the lower 16 bits of the epoch unchanged during each increment, diff --git a/src/compute/src/lib.rs b/src/compute/src/lib.rs index bcea279bf6ac0..2d48a041986d2 100644 --- a/src/compute/src/lib.rs +++ b/src/compute/src/lib.rs @@ -15,7 +15,6 @@ #![feature(trait_alias)] #![feature(coroutines)] #![feature(type_alias_impl_trait)] -#![feature(let_chains)] #![feature(impl_trait_in_assoc_type)] #![feature(coverage_attribute)] #![warn(clippy::large_futures, clippy::large_stack_frames)] diff --git a/src/compute/tests/cdc_tests.rs b/src/compute/tests/cdc_tests.rs index b4c2a3633280c..b86b35fd772a1 100644 --- a/src/compute/tests/cdc_tests.rs +++ b/src/compute/tests/cdc_tests.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] #![feature(coroutines)] use std::collections::{BTreeMap, HashMap}; diff --git a/src/connector/codec/src/lib.rs b/src/connector/codec/src/lib.rs index 9dec1c9de5d0a..1b8b968d98eb8 100644 --- a/src/connector/codec/src/lib.rs +++ b/src/connector/codec/src/lib.rs @@ -15,13 +15,11 @@ //! Encoding and decoding between external data formats and RisingWave datum (i.e., type mappings). #![allow(clippy::derive_partial_eq_without_eq)] -#![feature(array_chunks)] #![feature(coroutines)] #![feature(proc_macro_hygiene)] #![feature(stmt_expr_attributes)] #![feature(box_patterns)] #![feature(trait_alias)] -#![feature(let_chains)] #![feature(box_into_inner)] #![feature(type_alias_impl_trait)] #![feature(associated_type_defaults)] diff --git a/src/connector/src/connector_common/postgres.rs b/src/connector/src/connector_common/postgres.rs index 9322dd1692e70..7badff60f8b43 100644 --- a/src/connector/src/connector_common/postgres.rs +++ b/src/connector/src/connector_common/postgres.rs @@ -46,12 +46,13 @@ const DISCOVER_PRIMARY_KEY_QUERY: &str = r#" ORDER BY array_position(i.indkey, a.attnum) "#; -#[derive(Debug, Clone, PartialEq, Deserialize)] +#[derive(Debug, Clone, PartialEq, Deserialize, Default)] #[serde(rename_all = "lowercase")] pub enum SslMode { #[serde(alias = "disable")] Disabled, #[serde(alias = "prefer")] + #[default] Preferred, #[serde(alias = "require")] Required, @@ -65,12 +66,6 @@ pub enum SslMode { VerifyFull, } -impl Default for SslMode { - fn default() -> Self { - Self::Preferred - } -} - pub struct PostgresExternalTable { column_descs: Vec, pk_names: Vec, diff --git a/src/connector/src/lib.rs b/src/connector/src/lib.rs index 32be220c2bd96..61a70d0585de8 100644 --- a/src/connector/src/lib.rs +++ b/src/connector/src/lib.rs @@ -14,13 +14,11 @@ #![allow(clippy::derive_partial_eq_without_eq)] #![warn(clippy::large_futures, clippy::large_stack_frames)] -#![feature(array_chunks)] #![feature(coroutines)] #![feature(proc_macro_hygiene)] #![feature(stmt_expr_attributes)] #![feature(box_patterns)] #![feature(trait_alias)] -#![feature(let_chains)] #![feature(box_into_inner)] #![feature(type_alias_impl_trait)] #![feature(associated_type_defaults)] @@ -39,6 +37,7 @@ #![recursion_limit = "256"] #![feature(min_specialization)] #![feature(custom_inner_attributes)] +#![feature(iter_array_chunks)] use std::time::Duration; @@ -47,7 +46,6 @@ use serde::de; pub mod aws_utils; -#[rustfmt::skip] pub mod allow_alter_on_fly_fields; mod enforce_secret; diff --git a/src/connector/src/parser/debezium/debezium_parser.rs b/src/connector/src/parser/debezium/debezium_parser.rs index 5c6ae354ad75c..dafce3996c7d9 100644 --- a/src/connector/src/parser/debezium/debezium_parser.rs +++ b/src/connector/src/parser/debezium/debezium_parser.rs @@ -273,7 +273,7 @@ mod tests { #[tokio::test] async fn test_parse_additional_columns() { - let columns = vec![ + let columns = [ ColumnDesc::named("O_ORDERKEY", ColumnId::new(1), DataType::Int64), ColumnDesc::named("O_CUSTKEY", ColumnId::new(2), DataType::Int64), ColumnDesc::named("O_ORDERSTATUS", ColumnId::new(3), DataType::Varchar), diff --git a/src/connector/src/parser/debezium/mongo_json_parser.rs b/src/connector/src/parser/debezium/mongo_json_parser.rs index 0449ef8066678..7f6751c2da712 100644 --- a/src/connector/src/parser/debezium/mongo_json_parser.rs +++ b/src/connector/src/parser/debezium/mongo_json_parser.rs @@ -372,7 +372,7 @@ serde_json::json!({"_id": {"$numberLong": "1001"},"first_name": "Sally","last_na // data without payload and schema field br#"{"before":null,"after":"{\"_id\": {\"$numberLong\": \"1004\"},\"first_name\": \"Anne\",\"last_name\": \"Kretchmar\",\"email\": \"annek@noanswer.org\"}","patch":null,"filter":null,"updateDescription":null,"source":{"version":"2.1.4.Final","connector":"mongodb","name":"dbserver1","ts_ms":1681879044000,"snapshot":"last","db":"inventory","sequence":null,"rs":"rs0","collection":"customers","ord":1,"lsid":null,"txnNumber":null},"op":"r","ts_ms":1681879054736,"transaction":null}"#.to_vec()]; - let columns = vec![ + let columns = [ ColumnDesc::named("_id", ColumnId::new(0), DataType::Int64), ColumnDesc::named("first_name", ColumnId::new(1), DataType::Varchar), ColumnDesc::named("last_name", ColumnId::new(2), DataType::Varchar), @@ -424,7 +424,7 @@ serde_json::json!({"_id": {"$numberLong": "1001"},"first_name": "Sally","last_na #[tokio::test] async fn test_strong_schema_datetime() { - let columns = vec![ + let columns = [ ColumnDesc::named("_id", ColumnId::new(0), DataType::Int64), ColumnDesc::named("rocket type", ColumnId::new(1), DataType::Varchar), ColumnDesc::named("freezed at", ColumnId::new(2), DataType::Date), @@ -552,7 +552,7 @@ serde_json::json!({"_id": {"$numberLong": "1001"},"first_name": "Sally","last_na #[tokio::test] async fn test_bson_v2_debezium_basic_types() { - let columns = vec![ + let columns = [ ColumnDesc::named("_id", ColumnId::new(0), DataType::Int64), ColumnDesc::named("name", ColumnId::new(1), DataType::Varchar), ColumnDesc::named("age", ColumnId::new(2), DataType::Int32), @@ -638,7 +638,7 @@ serde_json::json!({"_id": {"$numberLong": "1001"},"first_name": "Sally","last_na #[tokio::test] async fn test_bson_v2_debezium_struct() { - let columns = vec![ + let columns = [ ColumnDesc::named("_id", ColumnId::new(0), DataType::Int64), ColumnDesc::named( "struct_data", @@ -739,7 +739,7 @@ serde_json::json!({"_id": {"$numberLong": "1001"},"first_name": "Sally","last_na #[tokio::test] async fn test_bson_v2_debezium_list() { - let columns = vec![ + let columns = [ ColumnDesc::named("_id", ColumnId::new(0), DataType::Int64), ColumnDesc::named("hobbies", ColumnId::new(1), DataType::Varchar.list()), ]; @@ -842,7 +842,7 @@ serde_json::json!({"_id": {"$numberLong": "1001"},"first_name": "Sally","last_na } #[tokio::test] async fn test_null_and_overflow() { - let columns = vec![ + let columns = [ ColumnDesc::named("_id", ColumnId::new(0), DataType::Int64), ColumnDesc::named("name", ColumnId::new(1), DataType::Varchar), ColumnDesc::named("age", ColumnId::new(2), DataType::Int32), diff --git a/src/connector/src/parser/json_parser.rs b/src/connector/src/parser/json_parser.rs index bbd9f79e9a3fe..fbbeb76a74bfc 100644 --- a/src/connector/src/parser/json_parser.rs +++ b/src/connector/src/parser/json_parser.rs @@ -293,7 +293,7 @@ mod tests { #[tokio::test] async fn test_json_parse_struct() { - let descs = vec![ + let descs = [ ColumnDesc::named( "data", 0.into(), @@ -371,7 +371,7 @@ mod tests { #[tokio::test] async fn test_json_parse_struct_from_string() { - let descs = vec![ColumnDesc::named( + let descs = [ColumnDesc::named( "struct", 0.into(), DataType::from(StructType::new([ @@ -407,7 +407,7 @@ mod tests { #[tokio::test] #[tracing_test::traced_test] async fn test_json_parse_struct_missing_field_warning() { - let descs = vec![ColumnDesc::named( + let descs = [ColumnDesc::named( "struct", 0.into(), DataType::from(StructType::new([ diff --git a/src/connector/src/parser/unified/debezium.rs b/src/connector/src/parser/unified/debezium.rs index 8106276073c93..43d19c2f7c9d9 100644 --- a/src/connector/src/parser/unified/debezium.rs +++ b/src/connector/src/parser/unified/debezium.rs @@ -575,7 +575,7 @@ pub fn extract_bson_id(id_type: &DataType, bson_doc: &serde_json::Value) -> Acce DataType::Varchar => match id_field { serde_json::Value::String(s) => Some(ScalarImpl::Utf8(s.clone().into())), serde_json::Value::Object(obj) if obj.contains_key("$oid") => Some(ScalarImpl::Utf8( - obj["$oid"].as_str().to_owned().unwrap_or_default().into(), + obj["$oid"].as_str().unwrap_or_default().into(), )), _ => return Err(type_error()), }, diff --git a/src/connector/src/sink/encoder/avro.rs b/src/connector/src/sink/encoder/avro.rs index 9b8f44910139c..66a7530ef5473 100644 --- a/src/connector/src/sink/encoder/avro.rs +++ b/src/connector/src/sink/encoder/avro.rs @@ -210,7 +210,7 @@ enum OptIdx { /// * For `validate`, the inputs are (RisingWave type, ProtoBuf type). /// * For `encode`, the inputs are (RisingWave type, RisingWave data, ProtoBuf type). /// -/// Thus we impl [`MaybeData`] for both [`()`] and [`DatumRef`]. +/// Thus we impl [`MaybeData`] for both `()` and [`DatumRef`]. trait MaybeData: std::fmt::Debug { type Out; diff --git a/src/connector/src/sink/encoder/json.rs b/src/connector/src/sink/encoder/json.rs index 88d688c26a63a..82d8674d34c3f 100644 --- a/src/connector/src/sink/encoder/json.rs +++ b/src/connector/src/sink/encoder/json.rs @@ -169,7 +169,7 @@ impl RowEncoder for JsonEncoder { Ok(if let Some(param) = &self.kafka_connect { json_converter_with_schema( Value::Object(mappings), - param.schema_name.to_owned(), + param.schema_name.clone(), col_indices.into_iter().map(|i| &self.schema[i]), ) } else { diff --git a/src/connector/src/sink/encoder/proto.rs b/src/connector/src/sink/encoder/proto.rs index 9b7f697145332..45688e2815699 100644 --- a/src/connector/src/sink/encoder/proto.rs +++ b/src/connector/src/sink/encoder/proto.rs @@ -143,11 +143,11 @@ impl MessageIndexes { const TAG_MESSAGE_NESTED: i32 = 3; let mut indexes = vec![]; - let mut path = desc.path().array_chunks(); - let &[tag, idx] = path.next().unwrap(); + let mut path = desc.path().iter().copied().array_chunks(); + let [tag, idx] = path.next().unwrap(); assert_eq!(tag, TAG_FILE_MESSAGE); indexes.push(idx); - for &[tag, idx] in path { + for [tag, idx] in path { assert_eq!(tag, TAG_MESSAGE_NESTED); indexes.push(idx); } @@ -175,7 +175,7 @@ impl MessageIndexes { /// * For `validate`, the inputs are (RisingWave type, ProtoBuf type). /// * For `encode`, the inputs are (RisingWave type, RisingWave data, ProtoBuf type). /// -/// Thus we impl [`MaybeData`] for both [`()`] and [`ScalarRefImpl`]. +/// Thus we impl [`MaybeData`] for both `()` and [`ScalarRefImpl`]. trait MaybeData: std::fmt::Debug { type Out; diff --git a/src/connector/src/sink/snowflake_redshift/snowflake.rs b/src/connector/src/sink/snowflake_redshift/snowflake.rs index a6b8d3bded8f6..481afae795475 100644 --- a/src/connector/src/sink/snowflake_redshift/snowflake.rs +++ b/src/connector/src/sink/snowflake_redshift/snowflake.rs @@ -153,13 +153,11 @@ impl SnowflakeV2Config { let database = self .snowflake_database .clone() - .ok_or(SinkError::Config(anyhow!("database is required")))? - .to_owned(); + .ok_or(SinkError::Config(anyhow!("database is required")))?; let schema_name = self .snowflake_schema .clone() - .ok_or(SinkError::Config(anyhow!("schema is required")))? - .to_owned(); + .ok_or(SinkError::Config(anyhow!("schema is required")))?; let mut snowflake_task_ctx = SnowflakeTaskContext { target_table_name: target_table_name.clone(), database, @@ -172,7 +170,7 @@ impl SnowflakeV2Config { .jdbc_url .clone() .ok_or(SinkError::Config(anyhow!("jdbc.url is required")))? - .to_owned(); + .clone(); let username = self .username .clone() diff --git a/src/connector/src/sink/utils.rs b/src/connector/src/sink/utils.rs index b3ce4a6ae2b87..b3ce16d255537 100644 --- a/src/connector/src/sink/utils.rs +++ b/src/connector/src/sink/utils.rs @@ -51,6 +51,7 @@ pub(crate) mod dummy { LogSinker, SinkCommitCoordinator, SinkCommittedEpochSubscriber, SinkLogReader, }; + #[allow(dead_code)] pub fn err_feature_not_enabled(sink_name: &'static str) -> SinkError { SinkError::Config(anyhow!( "RisingWave is not compiled with feature `sink-{}`", @@ -60,9 +61,11 @@ pub(crate) mod dummy { /// Implement this trait will bring a dummy `impl Sink` for the type which always returns an error. pub trait FeatureNotEnabledSinkMarker: Send + 'static { + #[allow(dead_code)] const SINK_NAME: &'static str; } + #[allow(dead_code)] pub struct FeatureNotEnabledCoordinator(PhantomData); #[async_trait::async_trait] impl SinkCommitCoordinator for FeatureNotEnabledCoordinator { @@ -80,6 +83,7 @@ pub(crate) mod dummy { } } + #[allow(dead_code)] pub struct FeatureNotEnabledLogSinker(PhantomData); #[async_trait::async_trait] impl LogSinker for FeatureNotEnabledLogSinker { diff --git a/src/connector/src/source/cdc/external/mysql.rs b/src/connector/src/source/cdc/external/mysql.rs index 0521dd7c3e3ec..588fb106ed920 100644 --- a/src/connector/src/source/cdc/external/mysql.rs +++ b/src/connector/src/source/cdc/external/mysql.rs @@ -479,20 +479,7 @@ impl MySqlExternalTableReader { // Set session timezone to UTC conn.exec_drop("SET time_zone = \"+00:00\"", ()).await?; - if start_pk_row.is_none() { - let rs_stream = sql.stream::(&mut conn).await?; - let row_stream = rs_stream.map(|row| { - // convert mysql row into OwnedRow - let mut row = row?; - Ok::<_, ConnectorError>(mysql_row_to_owned_row(&mut row, &self.rw_schema)) - }); - pin_mut!(row_stream); - #[for_await] - for row in row_stream { - let row = row?; - yield row; - } - } else { + if let Some(start_pk_row) = start_pk_row { let field_map = self .rw_schema .fields @@ -503,7 +490,7 @@ impl MySqlExternalTableReader { // fill in start primary key params let params: Vec<_> = primary_keys .iter() - .zip_eq_fast(start_pk_row.unwrap().into_iter()) + .zip_eq_fast(start_pk_row.into_iter()) .map(|(pk, datum)| { if let Some(value) = datum { let ty = field_map.get(pk.as_str()).unwrap(); @@ -552,7 +539,20 @@ impl MySqlExternalTableReader { let row = row?; yield row; } - }; + } else { + let rs_stream = sql.stream::(&mut conn).await?; + let row_stream = rs_stream.map(|row| { + // convert mysql row into OwnedRow + let mut row = row?; + Ok::<_, ConnectorError>(mysql_row_to_owned_row(&mut row, &self.rw_schema)) + }); + pin_mut!(row_stream); + #[for_await] + for row in row_stream { + let row = row?; + yield row; + } + } drop(conn); } @@ -681,7 +681,7 @@ mod tests { #[ignore] #[tokio::test] async fn test_mysql_table_reader() { - let columns = vec![ + let columns = [ ColumnDesc::named("v1", ColumnId::new(1), DataType::Int32), ColumnDesc::named("v2", ColumnId::new(2), DataType::Decimal), ColumnDesc::named("v3", ColumnId::new(3), DataType::Varchar), diff --git a/src/connector/src/source/cdc/external/postgres.rs b/src/connector/src/source/cdc/external/postgres.rs index 7471a5d87377f..e4245c1473c2e 100644 --- a/src/connector/src/source/cdc/external/postgres.rs +++ b/src/connector/src/source/cdc/external/postgres.rs @@ -663,7 +663,7 @@ impl PostgresExternalTableReader { right_bound_exclusive = None; } Some(next_right) => { - next_left_bound_inclusive = next_right.to_owned(); + next_left_bound_inclusive = next_right.clone(); right_bound_exclusive = Some(next_right); } } @@ -1149,7 +1149,7 @@ mod tests { #[ignore] #[tokio::test] async fn test_pg_table_reader() { - let columns = vec![ + let columns = [ ColumnDesc::named("v1", ColumnId::new(1), DataType::Int32), ColumnDesc::named("v2", ColumnId::new(2), DataType::Varchar), ColumnDesc::named("v3", ColumnId::new(3), DataType::Decimal), diff --git a/src/connector/src/source/google_pubsub/enumerator/client.rs b/src/connector/src/source/google_pubsub/enumerator/client.rs index 144f75a4a4c29..4940e23007704 100644 --- a/src/connector/src/source/google_pubsub/enumerator/client.rs +++ b/src/connector/src/source/google_pubsub/enumerator/client.rs @@ -78,7 +78,7 @@ impl SplitEnumerator for PubsubSplitEnumerator { } Ok(Self { - subscription: properties.subscription.to_owned(), + subscription: properties.subscription, split_count, }) } @@ -88,7 +88,7 @@ impl SplitEnumerator for PubsubSplitEnumerator { let splits: Vec = (0..self.split_count) .map(|i| PubsubSplit { index: i, - subscription: self.subscription.to_owned(), + subscription: self.subscription.clone(), __deprecated_start_offset: None, __deprecated_stop_offset: None, }) diff --git a/src/connector/src/source/iceberg/mod.rs b/src/connector/src/source/iceberg/mod.rs index 529acfb0ac7c0..bf7c5c4a35f1b 100644 --- a/src/connector/src/source/iceberg/mod.rs +++ b/src/connector/src/source/iceberg/mod.rs @@ -312,8 +312,8 @@ impl IcebergSplitEnumerator { None => { // convert unix time to human-readable time let time = chrono::DateTime::from_timestamp_millis(timestamp); - if time.is_some() { - bail!("Cannot find a snapshot older than {}", time.unwrap()); + if let Some(time) = time { + bail!("Cannot find a snapshot older than {}", time); } else { bail!("Cannot find a snapshot"); } diff --git a/src/ctl/src/lib.rs b/src/ctl/src/lib.rs index 0f253833b4959..f6e6d712bf6d2 100644 --- a/src/ctl/src/lib.rs +++ b/src/ctl/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] #![warn(clippy::large_futures, clippy::large_stack_frames)] use anyhow::Result; diff --git a/src/error/src/macros.rs b/src/error/src/macros.rs index ef2873a9df49a..d3efb01d36aef 100644 --- a/src/error/src/macros.rs +++ b/src/error/src/macros.rs @@ -152,8 +152,6 @@ mod ensure_tests { use anyhow::anyhow; use thiserror::Error; - use super::*; - #[derive(Error, Debug)] #[error(transparent)] struct MyError(#[from] anyhow::Error); diff --git a/src/expr/core/src/expr_context.rs b/src/expr/core/src/expr_context.rs index aa197db9c1696..18839a80ae793 100644 --- a/src/expr/core/src/expr_context.rs +++ b/src/expr/core/src/expr_context.rs @@ -56,7 +56,7 @@ where Fut: Future, { TIME_ZONE::scope( - expr_context.time_zone.to_owned(), + expr_context.time_zone.clone(), STRICT_MODE::scope(expr_context.strict_mode, future), ) .await diff --git a/src/expr/core/src/lib.rs b/src/expr/core/src/lib.rs index f89ce571bec37..6a4158b5dca0d 100644 --- a/src/expr/core/src/lib.rs +++ b/src/expr/core/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] #![feature(iterator_try_collect)] #![feature(coroutines)] #![feature(never_type)] diff --git a/src/expr/impl/src/lib.rs b/src/expr/impl/src/lib.rs index 7b6f2154ca87b..9f1927513e8ab 100644 --- a/src/expr/impl/src/lib.rs +++ b/src/expr/impl/src/lib.rs @@ -21,7 +21,6 @@ //! ``` #![allow(non_snake_case)] // for `ctor` generated code -#![feature(let_chains)] #![feature(assert_matches)] #![feature(iterator_try_collect)] #![feature(coroutines)] diff --git a/src/expr/impl/src/scalar/cmp.rs b/src/expr/impl/src/scalar/cmp.rs index 8331f5c843a63..270419776a1c0 100644 --- a/src/expr/impl/src/scalar/cmp.rs +++ b/src/expr/impl/src/scalar/cmp.rs @@ -626,7 +626,7 @@ mod tests { const NAME: &'static str = "boolean"; fn test_from(i: usize) -> Self { - i % 2 == 0 + i.is_multiple_of(2) } } diff --git a/src/expr/impl/src/udf/external.rs b/src/expr/impl/src/udf/external.rs index b69deddf7976d..96ee80d0e8802 100644 --- a/src/expr/impl/src/udf/external.rs +++ b/src/expr/impl/src/udf/external.rs @@ -258,8 +258,8 @@ impl ExternalFunction { tracing::error!(?backoff, error = %err.as_report(), "UDF tonic error. retry..."); } ret => { - if ret.is_err() { - tracing::error!(error = %ret.as_ref().unwrap_err().as_report(), "UDF error. exiting..."); + if let Err(e) = &ret { + tracing::error!(error = %e.as_report(), "UDF error. exiting..."); } return ret; } diff --git a/src/expr/impl/tests/sig.rs b/src/expr/impl/tests/sig.rs index 28e2643145336..b83c758fe8de8 100644 --- a/src/expr/impl/tests/sig.rs +++ b/src/expr/impl/tests/sig.rs @@ -31,7 +31,7 @@ fn test_func_sig_map() { new_map .entry(sig.name.clone()) .or_default() - .entry(sig.inputs_type.to_vec()) + .entry(sig.inputs_type.clone()) .or_default() .push(sig.clone()); } diff --git a/src/expr/macro/src/lib.rs b/src/expr/macro/src/lib.rs index e2d2c4c2f4b8f..f12eab774e539 100644 --- a/src/expr/macro/src/lib.rs +++ b/src/expr/macro/src/lib.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] - use std::vec; use context::{CaptureContextAttr, DefineContextAttr, generate_captured_function}; diff --git a/src/frontend/planner_test/src/lib.rs b/src/frontend/planner_test/src/lib.rs index b7771798a218c..07f7d0ff8c5e4 100644 --- a/src/frontend/planner_test/src/lib.rs +++ b/src/frontend/planner_test/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] #![allow(clippy::derive_partial_eq_without_eq)] //! Data-driven tests. diff --git a/src/frontend/src/binder/bind_context.rs b/src/frontend/src/binder/bind_context.rs index 5df4197e74847..9e47051bcb681 100644 --- a/src/frontend/src/binder/bind_context.rs +++ b/src/frontend/src/binder/bind_context.rs @@ -268,7 +268,7 @@ impl BindContext { return Ok(vec![*non_nullable]); } else { // These will be converted to a `COALESCE(col1, col2, ..., coln)` - return Ok(columns.to_vec()); + return Ok(columns.clone()); } } } @@ -277,7 +277,7 @@ impl BindContext { column_name ))) } else { - Ok(columns.to_vec()) + Ok(columns.clone()) } } diff --git a/src/frontend/src/binder/expr/value.rs b/src/frontend/src/binder/expr/value.rs index 53cf249e8e376..b68a62db4f101 100644 --- a/src/frontend/src/binder/expr/value.rs +++ b/src/frontend/src/binder/expr/value.rs @@ -452,7 +452,7 @@ mod tests { "2 minutes", "1 month", ]; - let data = vec![ + let data = [ Literal::new( Some(ScalarImpl::Interval(Interval::from_minutes(60))), DataType::Interval, diff --git a/src/frontend/src/binder/relation/table_or_source.rs b/src/frontend/src/binder/relation/table_or_source.rs index e11ef9ba10874..36e209fabb63f 100644 --- a/src/frontend/src/binder/relation/table_or_source.rs +++ b/src/frontend/src/binder/relation/table_or_source.rs @@ -288,11 +288,7 @@ impl Binder { if self.database_id != database_id && !user.has_privilege(&PbObject::DatabaseId(database_id), AclMode::Connect) { - let db_name = self - .catalog - .get_database_by_id(&database_id)? - .name - .to_owned(); + let db_name = self.catalog.get_database_by_id(&database_id)?.name.clone(); return Err(PermissionDenied(format!( "permission denied for database \"{db_name}\"" diff --git a/src/frontend/src/catalog/system_catalog/information_schema/columns.rs b/src/frontend/src/catalog/system_catalog/information_schema/columns.rs index b2fbb851fbe65..6f7ba2403825f 100644 --- a/src/frontend/src/catalog/system_catalog/information_schema/columns.rs +++ b/src/frontend/src/catalog/system_catalog/information_schema/columns.rs @@ -18,7 +18,7 @@ use risingwave_frontend_macro::system_catalog; /// The view `columns` contains information about all table columns (or view columns) in the /// database. System columns (ctid, etc.) are not included. Only those columns are shown that the /// current user has access to (by way of being the owner or having some privilege). -/// Ref: [`https://www.postgresql.org/docs/current/infoschema-columns.html`] +/// Ref: `https://www.postgresql.org/docs/current/infoschema-columns.html` /// /// In RisingWave, `columns` also contains all materialized views' columns. #[system_catalog( diff --git a/src/frontend/src/catalog/system_catalog/information_schema/key_column_usage.rs b/src/frontend/src/catalog/system_catalog/information_schema/key_column_usage.rs index 2a0745c2c8baf..537d0a9df9d18 100644 --- a/src/frontend/src/catalog/system_catalog/information_schema/key_column_usage.rs +++ b/src/frontend/src/catalog/system_catalog/information_schema/key_column_usage.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The view `key_column_usage` contains all constraints belonging to tables that the current user owns or has some privilege other than SELECT on. -/// Ref: [`https://www.postgresql.org/docs/current/infoschema-key-column-usage.html`] +/// Ref: `https://www.postgresql.org/docs/current/infoschema-key-column-usage.html` /// Limitation: /// This view assume the constraint schema is the same as the table schema, since `pg_catalog`.`pg_constraint` only support primary key. #[system_catalog( diff --git a/src/frontend/src/catalog/system_catalog/information_schema/schemata.rs b/src/frontend/src/catalog/system_catalog/information_schema/schemata.rs index c4fb112a4941c..2e3e970dc39ea 100644 --- a/src/frontend/src/catalog/system_catalog/information_schema/schemata.rs +++ b/src/frontend/src/catalog/system_catalog/information_schema/schemata.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The view schemata contains all schemas in the current database that the current user has access to (by way of being the owner or having some privilege). -/// Ref: [`https://www.postgresql.org/docs/current/infoschema-schemata.html`] +/// Ref: `https://www.postgresql.org/docs/current/infoschema-schemata.html` #[system_catalog( view, "information_schema.schemata", diff --git a/src/frontend/src/catalog/system_catalog/information_schema/table_constraints.rs b/src/frontend/src/catalog/system_catalog/information_schema/table_constraints.rs index 230fbe099c401..c58763a53b253 100644 --- a/src/frontend/src/catalog/system_catalog/information_schema/table_constraints.rs +++ b/src/frontend/src/catalog/system_catalog/information_schema/table_constraints.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The view `table_constraints` contains all constraints belonging to tables that the current user owns or has some privilege other than SELECT on. -/// Ref: [`https://www.postgresql.org/docs/current/infoschema-table-constraints.html`] +/// Ref: `https://www.postgresql.org/docs/current/infoschema-table-constraints.html` /// Limitation: /// This view assume the constraint schema is the same as the table schema, since `pg_catalog`.`pg_constraint` only support primary key. #[system_catalog( diff --git a/src/frontend/src/catalog/system_catalog/information_schema/tables.rs b/src/frontend/src/catalog/system_catalog/information_schema/tables.rs index 89c0686488065..9866d97cb63d9 100644 --- a/src/frontend/src/catalog/system_catalog/information_schema/tables.rs +++ b/src/frontend/src/catalog/system_catalog/information_schema/tables.rs @@ -18,7 +18,7 @@ use risingwave_frontend_macro::system_catalog; /// The view tables contains all tables and views defined in the current database. Only those tables /// and views are shown that the current user has access to (by way of being the owner or having /// some privilege). -/// Ref: [`https://www.postgresql.org/docs/current/infoschema-tables.html`] +/// Ref: `https://www.postgresql.org/docs/current/infoschema-tables.html` /// /// In RisingWave, `tables` contains all relations. #[system_catalog( diff --git a/src/frontend/src/catalog/system_catalog/information_schema/views.rs b/src/frontend/src/catalog/system_catalog/information_schema/views.rs index 9b2fea5fb60b9..057dfd70a0c0f 100644 --- a/src/frontend/src/catalog/system_catalog/information_schema/views.rs +++ b/src/frontend/src/catalog/system_catalog/information_schema/views.rs @@ -18,7 +18,7 @@ use risingwave_frontend_macro::system_catalog; /// The view `views` contains all views defined in the current database. Only those views /// are shown that the current user has access to (by way of being the owner or having /// some privilege). -/// Ref: [`https://www.postgresql.org/docs/current/infoschema-views.html`] +/// Ref: `https://www.postgresql.org/docs/current/infoschema-views.html` /// /// In RisingWave, `views` contains information about defined views. #[system_catalog( diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_am.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_am.rs index 35e4670c92731..9c71c19c3dc55 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_am.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_am.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// Stores information about relation access methods. -/// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-am.html`] +/// Reference: `https://www.postgresql.org/docs/current/catalog-pg-am.html` #[system_catalog(view, "pg_catalog.pg_am")] #[derive(Fields)] struct PgAmColumn { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_attrdef.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_attrdef.rs index 2fa02fd2d74ff..2c6ad5c8913c4 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_attrdef.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_attrdef.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The catalog `pg_attrdef` stores column default values. The main information about columns is /// stored in `pg_attribute`. Only columns for which a default value has been explicitly set will -/// have an entry here. Ref: [`https://www.postgresql.org/docs/current/catalog-pg-attrdef.html`] +/// have an entry here. Ref: `https://www.postgresql.org/docs/current/catalog-pg-attrdef.html` #[system_catalog(view, "pg_catalog.pg_attrdef")] #[derive(Fields)] struct PgAttrdef { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_attribute.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_attribute.rs index 0bbe839089862..f2d203255daa2 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_attribute.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_attribute.rs @@ -18,7 +18,7 @@ use risingwave_frontend_macro::system_catalog; /// The catalog `pg_attribute` stores information about table columns. There will be exactly one /// `pg_attribute` row for every column in every table in the database. (There will also be /// attribute entries for indexes, and indeed all objects that have `pg_class` entries.) -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-attribute.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-attribute.html` /// /// In RisingWave, we simply make it contain the columns of the view and all the columns of the /// tables that are not internal tables. diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_auth_members.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_auth_members.rs index 89593b71611b5..ccc7c31175224 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_auth_members.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_auth_members.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_auth_members` shows the membership relations between roles. Any non-circular set of relationships is allowed. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-auth-members.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-auth-members.html` #[system_catalog(view, "pg_catalog.pg_auth_members")] #[derive(Fields)] struct PgAuthMember { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_cast.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_cast.rs index 080a93e27a856..cd24287cc509e 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_cast.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_cast.rs @@ -20,7 +20,7 @@ use crate::catalog::system_catalog::SysCatalogReaderImpl; use crate::expr::CAST_TABLE; /// The catalog `pg_cast` stores data type conversion paths. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-cast.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-cast.html` #[derive(Fields)] struct PgCast { #[primary_key] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_class.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_class.rs index c5ab28e070291..cede624efa175 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_class.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_class.rs @@ -20,7 +20,7 @@ use crate::catalog::system_catalog::SysCatalogReaderImpl; use crate::error::Result; /// The catalog `pg_class` catalogs tables and most everything else that has columns or is otherwise -/// similar to a table. Ref: [`https://www.postgresql.org/docs/current/catalog-pg-class.html`] +/// similar to a table. Ref: `https://www.postgresql.org/docs/current/catalog-pg-class.html` #[derive(Fields)] struct PgClass { #[primary_key] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_collation.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_collation.rs index 7a5a82f23186d..d525261c24e52 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_collation.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_collation.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// Mapping from sql name to system locale groups. -/// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-collation.html`]. +/// Reference: `https://www.postgresql.org/docs/current/catalog-pg-collation.html`. #[system_catalog(view, "pg_catalog.pg_collation")] #[derive(Fields)] struct PgCollation { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_constraint.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_constraint.rs index 2e266011fbdd0..e5745e4905b1c 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_constraint.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_constraint.rs @@ -21,7 +21,7 @@ use crate::catalog::system_catalog::{SysCatalogReaderImpl, SystemTableCatalog}; use crate::error::Result; /// The catalog `pg_constraint` records information about table and index inheritance hierarchies. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-constraint.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-constraint.html` /// This is introduced only for pg compatibility and is not used in our system. #[derive(Fields)] struct PgConstraint { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_conversion.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_conversion.rs index 35da64fb32f69..60730f7cb2195 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_conversion.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_conversion.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_conversion` describes encoding conversion functions. -/// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-conversion.html`] +/// Reference: `https://www.postgresql.org/docs/current/catalog-pg-conversion.html` #[system_catalog(view, "pg_catalog.pg_conversion")] #[derive(Fields)] struct PgConversion { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_depend.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_depend.rs index ade3e9da2b989..f68979c0c4932 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_depend.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_depend.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_depend` records the dependency relationships between database objects. -/// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-depend.html`] +/// Reference: `https://www.postgresql.org/docs/current/catalog-pg-depend.html` #[system_catalog(view, "pg_catalog.pg_depend")] #[derive(Fields)] struct PgDepend { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_description.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_description.rs index 14dde7a62de97..43c1ee75f28ec 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_description.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_description.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_description` stores description. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-description.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-description.html` #[system_catalog(view, "pg_catalog.pg_description", // objsubid = 0 => _row_id (hidden column) // objsubid is NULL => table self diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_enum.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_enum.rs index 24f2ba7467f19..05e377bff7075 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_enum.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_enum.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The `pg_enum` catalog contains entries showing the values and labels for each enum type. /// The internal representation of a given enum value is actually the OID of its associated row in -/// `pg_enum`. Reference: [`https://www.postgresql.org/docs/current/catalog-pg-enum.html`] +/// `pg_enum`. Reference: `https://www.postgresql.org/docs/current/catalog-pg-enum.html` #[system_catalog(view, "pg_catalog.pg_enum")] #[derive(Fields)] struct PgEnum { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_index.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_index.rs index 87b27c19d2267..e5a39fc702c4d 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_index.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_index.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_index` contains part of the information about indexes. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-index.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-index.html` #[system_catalog( view, "pg_catalog.pg_index", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_indexes.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_indexes.rs index 31251d2e933e5..3424bae0c0164 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_indexes.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_indexes.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The view `pg_indexes` provides access to useful information about each index in the database. -/// Ref: [`https://www.postgresql.org/docs/current/view-pg-indexes.html`] +/// Ref: `https://www.postgresql.org/docs/current/view-pg-indexes.html` #[system_catalog( view, "pg_catalog.pg_indexes", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_inherits.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_inherits.rs index 7cd019d57e8da..19f00ec781a45 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_inherits.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_inherits.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_inherits` records information about table and index inheritance hierarchies. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-inherits.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-inherits.html` /// This is introduced only for pg compatibility and is not used in our system. #[system_catalog(view, "pg_catalog.pg_inherits")] #[derive(Fields)] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_language.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_language.rs index c231873838551..b5536dcf28956 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_language.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_language.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_language` registers languages in which you can write functions or stored procedures. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-language.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-language.html` /// This is introduced only for pg compatibility and is not used in our system. #[system_catalog(view, "pg_catalog.pg_language")] #[derive(Fields)] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_locks.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_locks.rs index 4f5e407db5b69..751882e6e3ea5 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_locks.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_locks.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The catalog `pg_locks` provides access to information about the locks held by active processes /// within the database server. -/// Reference: [`https://www.postgresql.org/docs/current/view-pg-locks.html`]. +/// Reference: `https://www.postgresql.org/docs/current/view-pg-locks.html`. /// Currently, we don't have any type of lock. #[system_catalog(view, "pg_catalog.pg_locks")] #[derive(Fields)] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_matviews.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_matviews.rs index d9cbfbefd561f..07cc78f02c736 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_matviews.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_matviews.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The view `pg_matviews` provides access to useful information about each materialized view in the /// database. -/// Ref: [`https://www.postgresql.org/docs/current/view-pg-matviews.html`] +/// Ref: `https://www.postgresql.org/docs/current/view-pg-matviews.html` #[system_catalog( view, "pg_catalog.pg_matviews", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_namespace.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_namespace.rs index 6d7a5fc14fe4e..8469eeacbc8b1 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_namespace.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_namespace.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The catalog `pg_namespace` stores namespaces. A namespace is the structure underlying SQL /// schemas: each namespace can have a separate collection of relations, types, etc. without name -/// conflicts. Ref: [`https://www.postgresql.org/docs/current/catalog-pg-namespace.html`] +/// conflicts. Ref: `https://www.postgresql.org/docs/current/catalog-pg-namespace.html` #[system_catalog( view, "pg_catalog.pg_namespace", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_opclass.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_opclass.rs index d8ef9365a4f49..e19ce4f1c5501 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_opclass.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_opclass.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_opclass` defines index access method operator classes. -/// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-opclass.html`]. +/// Reference: `https://www.postgresql.org/docs/current/catalog-pg-opclass.html`. #[system_catalog(view, "pg_catalog.pg_opclass")] #[derive(Fields)] struct PgOpclass { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_operator.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_operator.rs index 5031d3893d8c2..72c2272383189 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_operator.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_operator.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_operator` stores operator info. -/// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-operator.html`] +/// Reference: `https://www.postgresql.org/docs/current/catalog-pg-operator.html` #[system_catalog(view, "pg_catalog.pg_operator")] #[derive(Fields)] struct PgOpclass { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_partitioned_table.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_partitioned_table.rs index 1a80b7e49206e..576326774521f 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_partitioned_table.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_partitioned_table.rs @@ -15,7 +15,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; -/// The catalog `pg_partitioned_table` stores information about how tables are partitioned. Reference: [`https://www.postgresql.org/docs/current/catalog-pg-partitioned-table.html`] +/// The catalog `pg_partitioned_table` stores information about how tables are partitioned. Reference: `https://www.postgresql.org/docs/current/catalog-pg-partitioned-table.html` #[system_catalog(view, "pg_catalog.pg_partitioned_table")] #[derive(Fields)] struct PgPartitionedTable { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_proc.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_proc.rs index a79a6c0414367..7a2ce6ca4c5f0 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_proc.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_proc.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The catalog `pg_proc` stores information about functions, procedures, aggregate functions, and /// window functions (collectively also known as routines). -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-proc.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-proc.html` // TODO: read real data including oid etc in rw, currently there are no such data in rw. // more details can be found here: https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_proc.dat #[system_catalog(view, "pg_catalog.pg_proc")] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_range.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_range.rs index aeb8efb909ceb..cd95a98f64c49 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_range.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_range.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_range` stores information about range types. This is in addition to the types' entries in `pg_type`. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-range.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-range.html` #[system_catalog(view, "pg_catalog.pg_range")] #[derive(Fields)] struct PgRange { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_rewrite.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_rewrite.rs index 83fc6ff5f97c2..4386ce0ef7a08 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_rewrite.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_rewrite.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_rewrite` stores rewrite rules for tables and views. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-rewrite.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-rewrite.html` /// This is introduced only for pg compatibility and is not used in our system. #[system_catalog(view, "pg_catalog.pg_rewrite")] #[derive(Fields)] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_roles.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_roles.rs index 01e8e5d07cc63..a1787ba56c77d 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_roles.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_roles.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The catalog `pg_roles` provides access to information about database roles. This is simply a /// publicly readable view of `pg_authid` that blanks out the password field. -/// Ref: [`https://www.postgresql.org/docs/current/view-pg-roles.html`] +/// Ref: `https://www.postgresql.org/docs/current/view-pg-roles.html` #[system_catalog( view, "pg_catalog.pg_roles", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs index a7e0a52da59ce..6589c4743fe7b 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequence.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_sequence` contains information about sequences. -/// Reference: [`https://www.postgresql.org/docs/current/catalog-pg-sequence.html`] +/// Reference: `https://www.postgresql.org/docs/current/catalog-pg-sequence.html` #[system_catalog(view, "pg_catalog.pg_sequence")] #[derive(Fields)] struct PgSequenceColumn { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequences.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequences.rs index 129b5e863465e..34d124eda96e7 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequences.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_sequences.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The view `pg_sequences` provides access to useful information about each sequence in the database. -/// Ref: [`https://www.postgresql.org/docs/current/view-pg-sequences.html`] +/// Ref: `https://www.postgresql.org/docs/current/view-pg-sequences.html` #[system_catalog(view, "pg_catalog.pg_sequences")] #[derive(Fields)] struct PgSequences { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_settings.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_settings.rs index c5e4ea7fedc8d..e020d48cc14d9 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_settings.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_settings.rs @@ -19,7 +19,7 @@ use risingwave_frontend_macro::system_catalog; use crate::catalog::system_catalog::SysCatalogReaderImpl; /// The catalog `pg_settings` stores settings. -/// Ref: [`https://www.postgresql.org/docs/current/view-pg-settings.html`] +/// Ref: `https://www.postgresql.org/docs/current/view-pg-settings.html` #[derive(Fields)] #[primary_key(name, context)] struct PgSetting { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_shadow.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_shadow.rs index 8beb12e8381f7..973929c832132 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_shadow.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_shadow.rs @@ -16,7 +16,7 @@ use risingwave_common::types::{Fields, Timestamptz}; use risingwave_frontend_macro::system_catalog; /// The view `pg_shadow` exists for backwards compatibility: it emulates a catalog that existed in /// PostgreSQL before version 8.1. It shows properties of all roles that are marked as rolcanlogin -/// in `pg_authid`. Ref: [`https://www.postgresql.org/docs/current/view-pg-shadow.html`] +/// in `pg_authid`. Ref: `https://www.postgresql.org/docs/current/view-pg-shadow.html` #[system_catalog( view, "pg_catalog.pg_shadow", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_shdescription.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_shdescription.rs index ee85192365ec6..dfe5f32866e98 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_shdescription.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_shdescription.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_shdescription` stores optional descriptions (comments) for shared database -/// objects. Ref: [`https://www.postgresql.org/docs/current/catalog-pg-shdescription.html`] +/// objects. Ref: `https://www.postgresql.org/docs/current/catalog-pg-shdescription.html` #[system_catalog(view, "pg_catalog.pg_shdescription")] #[derive(Fields)] struct PgShdescription { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_stat_activity.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_stat_activity.rs index 269d72674b64b..eff2d92b436b9 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_stat_activity.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_stat_activity.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The `pg_stat_activity` view will have one row per server process, showing information related to /// the current activity of that process. -/// Ref: [`https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW`] +/// Ref: `https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ACTIVITY-VIEW` #[system_catalog(view, "pg_catalog.pg_stat_activity")] #[derive(Fields)] struct PgStatActivity { diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_stat_user_tables.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_stat_user_tables.rs index 3f1b49bc736e9..2843c38c7a03b 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_stat_user_tables.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_stat_user_tables.rs @@ -17,7 +17,7 @@ use risingwave_frontend_macro::system_catalog; /// The `pg_stat_user_tables` view will contain one row for each user table in the current database, /// showing statistics about accesses to that specific table. -/// Ref: [`https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW`] +/// Ref: `https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-ALL-TABLES-VIEW` #[system_catalog( view, "pg_catalog.pg_stat_user_tables", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_tables.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_tables.rs index c6afdb8376fd3..e29ce3050a865 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_tables.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_tables.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The view `pg_tables` provides access to useful information about each table in the database. -/// Ref: [`https://www.postgresql.org/docs/current/view-pg-tables.html`] +/// Ref: `https://www.postgresql.org/docs/current/view-pg-tables.html` #[system_catalog( view, "pg_catalog.pg_tables", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_tablespace.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_tablespace.rs index cc34f67ed979a..4d8c7cd0ed8de 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_tablespace.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_tablespace.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_tablespace` stores information about the available tablespaces. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-tablespace.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-tablespace.html` /// This is introduced only for pg compatibility and is not used in our system. #[system_catalog(view, "pg_catalog.pg_tablespace")] #[derive(Fields)] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_trigger.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_trigger.rs index a94efd52b6f41..3884300f0656b 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_trigger.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_trigger.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_trigger` stores triggers on tables and views. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-trigger.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-trigger.html` /// This is introduced only for pg compatibility and is not used in our system. #[system_catalog(view, "pg_catalog.pg_trigger")] #[derive(Fields)] diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_type.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_type.rs index 7203ae2711348..4a35d25c16396 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_type.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_type.rs @@ -20,7 +20,7 @@ use crate::catalog::system_catalog::rw_catalog::rw_types::read_rw_types; use crate::error::Result; /// The catalog `pg_type` stores information about data types. -/// Ref: [`https://www.postgresql.org/docs/current/catalog-pg-type.html`] +/// Ref: `https://www.postgresql.org/docs/current/catalog-pg-type.html` // TODO: Make it a view atop of `rw_types` to reduce code duplication of the // `read` function, while reserving the property that `oid` acts as the diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_user.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_user.rs index f8e5b02756992..7339b89bcd046 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_user.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_user.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The catalog `pg_user` provides access to information about database users. -/// Ref: [`https://www.postgresql.org/docs/current/view-pg-user.html`] +/// Ref: `https://www.postgresql.org/docs/current/view-pg-user.html` #[system_catalog( view, "pg_catalog.pg_user", diff --git a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_views.rs b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_views.rs index b9c8026229bf2..0099a16e04adf 100644 --- a/src/frontend/src/catalog/system_catalog/pg_catalog/pg_views.rs +++ b/src/frontend/src/catalog/system_catalog/pg_catalog/pg_views.rs @@ -16,7 +16,7 @@ use risingwave_common::types::Fields; use risingwave_frontend_macro::system_catalog; /// The view `pg_views` provides access to useful information about each view in the database. -/// Ref: [`https://www.postgresql.org/docs/current/view-pg-views.html`] +/// Ref: `https://www.postgresql.org/docs/current/view-pg-views.html` #[system_catalog( view, "pg_catalog.pg_views", diff --git a/src/frontend/src/catalog/system_catalog/rw_catalog/rw_sources.rs b/src/frontend/src/catalog/system_catalog/rw_catalog/rw_sources.rs index 7ecfbbcd2a99b..f24d94e3b1325 100644 --- a/src/frontend/src/catalog/system_catalog/rw_catalog/rw_sources.rs +++ b/src/frontend/src/catalog/system_catalog/rw_catalog/rw_sources.rs @@ -136,7 +136,7 @@ pub fn serialize_props_with_secret( .unwrap() .find_map(|schema| schema.get_secret_by_id(&SecretId(v.secret_id))); let secret_name = secret - .map(|s| s.name.to_owned()) + .map(|s| s.name.clone()) .unwrap_or("not found".to_owned()); result.insert( k, diff --git a/src/frontend/src/catalog/system_catalog/rw_catalog/rw_worker_nodes.rs b/src/frontend/src/catalog/system_catalog/rw_catalog/rw_worker_nodes.rs index 13e6072942ded..9de443fdd5ea0 100644 --- a/src/frontend/src/catalog/system_catalog/rw_catalog/rw_worker_nodes.rs +++ b/src/frontend/src/catalog/system_catalog/rw_catalog/rw_worker_nodes.rs @@ -76,7 +76,7 @@ async fn read_rw_worker_nodes_info(reader: &SysCatalogReaderImpl) -> Result Self { - Self::Table - } -} - impl TableType { fn from_prost(prost: PbTableType) -> Self { match prost { diff --git a/src/frontend/src/expr/type_inference/func.rs b/src/frontend/src/expr/type_inference/func.rs index c31f0b0efd88d..952d6556fec83 100644 --- a/src/frontend/src/expr/type_inference/func.rs +++ b/src/frontend/src/expr/type_inference/func.rs @@ -765,7 +765,7 @@ fn infer_type_for_special( } ExprType::JsonbBuildArray => Ok(Some(DataType::Jsonb)), ExprType::JsonbBuildObject => { - if inputs.len() % 2 != 0 { + if !inputs.len().is_multiple_of(2) { return Err(ErrorCode::BindError( "argument list must have even number of elements".into(), ) diff --git a/src/frontend/src/handler/alter_user.rs b/src/frontend/src/handler/alter_user.rs index 939e0d215d435..3d9da6d4dddfd 100644 --- a/src/frontend/src/handler/alter_user.rs +++ b/src/frontend/src/handler/alter_user.rs @@ -216,7 +216,7 @@ pub async fn handle_alter_user( let session_user = user_reader .get_user_by_name(&session.user_name()) - .ok_or_else(|| CatalogError::NotFound("user", session.user_name().to_owned()))?; + .ok_or_else(|| CatalogError::NotFound("user", session.user_name()))?; match stmt.mode { risingwave_sqlparser::ast::AlterUserMode::Options(options) => { diff --git a/src/frontend/src/handler/create_schema.rs b/src/frontend/src/handler/create_schema.rs index 5e9a2a9d67068..3c01df4496a05 100644 --- a/src/frontend/src/handler/create_schema.rs +++ b/src/frontend/src/handler/create_schema.rs @@ -60,7 +60,7 @@ pub async fn handle_create_schema( }; } let db = reader.get_database_by_name(database_name)?; - (db.id(), db.name.to_owned(), db.owner()) + (db.id(), db.name.clone(), db.owner()) }; let schema_owner = if let Some(owner) = owner { diff --git a/src/frontend/src/handler/create_source/external_schema/nexmark.rs b/src/frontend/src/handler/create_source/external_schema/nexmark.rs index 651c2a84ff8a8..aef803ee79aac 100644 --- a/src/frontend/src/handler/create_source/external_schema/nexmark.rs +++ b/src/frontend/src/handler/create_source/external_schema/nexmark.rs @@ -54,7 +54,7 @@ pub fn check_nexmark_schema( .map(|c| { ( c.column_desc.name.to_ascii_lowercase(), - c.column_desc.data_type.to_owned(), + c.column_desc.data_type.clone(), ) }) .collect_vec(); diff --git a/src/frontend/src/handler/create_table.rs b/src/frontend/src/handler/create_table.rs index 1fbb374408c54..8787869ca4b58 100644 --- a/src/frontend/src/handler/create_table.rs +++ b/src/frontend/src/handler/create_table.rs @@ -863,7 +863,7 @@ pub(crate) fn gen_create_table_plan_for_cdc_table( let non_generated_column_descs = columns .iter() - .filter(|&c| (!c.is_generated())) + .filter(|&c| !c.is_generated()) .map(|c| c.column_desc.clone()) .collect_vec(); let non_generated_column_num = non_generated_column_descs.len(); @@ -1624,20 +1624,20 @@ pub async fn create_iceberg_engine_table( let mut with_common = BTreeMap::new(); with_common.insert("connector".to_owned(), "iceberg".to_owned()); - with_common.insert("database.name".to_owned(), iceberg_database_name.to_owned()); - with_common.insert("table.name".to_owned(), iceberg_table_name.to_owned()); + with_common.insert("database.name".to_owned(), iceberg_database_name); + with_common.insert("table.name".to_owned(), iceberg_table_name); if let Some(s) = params.properties.get("hosted_catalog") && s.eq_ignore_ascii_case("true") { with_common.insert("catalog.type".to_owned(), "jdbc".to_owned()); - with_common.insert("catalog.uri".to_owned(), catalog_uri.to_owned()); - with_common.insert("catalog.jdbc.user".to_owned(), meta_store_user.to_owned()); + with_common.insert("catalog.uri".to_owned(), catalog_uri); + with_common.insert("catalog.jdbc.user".to_owned(), meta_store_user); with_common.insert( "catalog.jdbc.password".to_owned(), meta_store_password.clone(), ); - with_common.insert("catalog.name".to_owned(), iceberg_catalog_name.to_owned()); + with_common.insert("catalog.name".to_owned(), iceberg_catalog_name); } with_common @@ -1978,7 +1978,7 @@ pub async fn create_iceberg_engine_table( )) })?; - partition_columns.push(column.to_owned()); + partition_columns.push(column); } ensure_partition_columns_are_prefix_of_primary_key(&partition_columns, &pks).map_err( diff --git a/src/frontend/src/handler/explain.rs b/src/frontend/src/handler/explain.rs index d24d3cdebd01d..3f042c8c184c4 100644 --- a/src/frontend/src/handler/explain.rs +++ b/src/frontend/src/handler/explain.rs @@ -239,7 +239,7 @@ pub async fn do_handle_explain( worker_node_manager_reader, session.env().catalog_reader().clone(), session.config().batch_parallelism().0, - session.config().timezone().to_owned(), + session.config().timezone(), plan.clone(), )?); batch_plan_fragmenter_fmt = if explain_format == ExplainFormat::Dot { diff --git a/src/frontend/src/handler/mod.rs b/src/frontend/src/handler/mod.rs index 479fbe9bf308e..b22455670504b 100644 --- a/src/frontend/src/handler/mod.rs +++ b/src/frontend/src/handler/mod.rs @@ -688,7 +688,7 @@ pub async fn handle( name, table_name, method, - columns.to_vec(), + columns.clone(), include, distributed_by, ) diff --git a/src/frontend/src/handler/query.rs b/src/frontend/src/handler/query.rs index 1b46319a04880..b1e4f5a209078 100644 --- a/src/frontend/src/handler/query.rs +++ b/src/frontend/src/handler/query.rs @@ -58,10 +58,9 @@ pub async fn handle_query( let context = OptimizerContext::from_handler_args(handler_args); let plan_result = gen_batch_plan_by_statement(&session, context.into(), stmt)?; // Time zone is used by Hummock time travel query. - risingwave_expr::expr_context::TIME_ZONE::sync_scope( - session.config().timezone().to_owned(), - || gen_batch_plan_fragmenter(&session, plan_result), - )? + risingwave_expr::expr_context::TIME_ZONE::sync_scope(session.config().timezone(), || { + gen_batch_plan_fragmenter(&session, plan_result) + })? }; execute(session, plan_fragmenter_result, formats).await } @@ -117,7 +116,7 @@ pub async fn handle_execute( let plan_result = gen_batch_query_plan(&session, context.into(), bound_result)?; // Time zone is used by Hummock time travel query. risingwave_expr::expr_context::TIME_ZONE::sync_scope( - session.config().timezone().to_owned(), + session.config().timezone(), || gen_batch_plan_fragmenter(&session, plan_result), )? }; @@ -384,7 +383,7 @@ pub fn gen_batch_plan_fragmenter( worker_node_manager_reader, session.env().catalog_reader().clone(), session.config().batch_parallelism().0, - session.config().timezone().to_owned(), + session.config().timezone(), plan, )?; diff --git a/src/frontend/src/handler/show.rs b/src/frontend/src/handler/show.rs index 5634e9195aa10..006c713bf3e14 100644 --- a/src/frontend/src/handler/show.rs +++ b/src/frontend/src/handler/show.rs @@ -792,7 +792,7 @@ pub async fn handle_show_object( let session_id = format!("{}", s.id().0); let user = s.user_name(); let host = format!("{}", s.peer_addr()); - let database = s.database().to_owned(); + let database = s.database().clone(); s.get_cursor_manager() .iter_subscription_cursors( diff --git a/src/frontend/src/lib.rs b/src/frontend/src/lib.rs index 4732e6ad9f379..45d7bf1629521 100644 --- a/src/frontend/src/lib.rs +++ b/src/frontend/src/lib.rs @@ -19,7 +19,6 @@ #![feature(proc_macro_hygiene, stmt_expr_attributes)] #![feature(trait_alias)] #![feature(if_let_guard)] -#![feature(let_chains)] #![feature(assert_matches)] #![feature(box_patterns)] #![feature(macro_metavar_expr)] diff --git a/src/frontend/src/optimizer/backfill_order_strategy.rs b/src/frontend/src/optimizer/backfill_order_strategy.rs index 3714e3e93c264..f0efb29e0ae42 100644 --- a/src/frontend/src/optimizer/backfill_order_strategy.rs +++ b/src/frontend/src/optimizer/backfill_order_strategy.rs @@ -348,7 +348,7 @@ mod common { if let Some((relation_id, _schema_name)) = result? { return Ok(relation_id); } - Err(CatalogError::NotFound("table", rel_name.to_owned()).into()) + Err(CatalogError::NotFound("table", rel_name.clone()).into()) } } } diff --git a/src/frontend/src/optimizer/optimizer_context.rs b/src/frontend/src/optimizer/optimizer_context.rs index fdbeff2fedafb..caa041ea44e18 100644 --- a/src/frontend/src/optimizer/optimizer_context.rs +++ b/src/frontend/src/optimizer/optimizer_context.rs @@ -91,7 +91,7 @@ impl OptimizerContext { /// Create a new [`OptimizerContext`] from the given [`HandlerArgs`] and [`ExplainOptions`]. pub fn new(mut handler_args: HandlerArgs, explain_options: ExplainOptions) -> Self { let session_timezone = RefCell::new(SessionTimezone::new( - handler_args.session.config().timezone().to_owned(), + handler_args.session.config().timezone(), )); let overwrite_options = OverwriteOptions::new(&mut handler_args); Self { diff --git a/src/frontend/src/optimizer/plan_node/logical_agg.rs b/src/frontend/src/optimizer/plan_node/logical_agg.rs index 61d9efca4dc9f..f1aff091c692e 100644 --- a/src/frontend/src/optimizer/plan_node/logical_agg.rs +++ b/src/frontend/src/optimizer/plan_node/logical_agg.rs @@ -157,7 +157,7 @@ impl LogicalAgg { local_group_key.insert(vnode_col_idx); let n_local_group_key = local_group_key.len(); let local_agg = new_stream_hash_agg( - Agg::new(core.agg_calls.to_vec(), local_group_key, project.into()), + Agg::new(core.agg_calls.clone(), local_group_key, project.into()), Some(vnode_col_idx), )?; // Global group key excludes vnode. @@ -1193,7 +1193,7 @@ impl PlanTreeNodeUnary for LogicalAgg { } fn clone_with_input(&self, input: PlanRef) -> Self { - Agg::new(self.agg_calls().to_vec(), self.group_key().clone(), input) + Agg::new(self.agg_calls().clone(), self.group_key().clone(), input) .with_grouping_sets(self.grouping_sets().clone()) .with_enable_two_phase(self.core().enable_two_phase) .into() @@ -1574,7 +1574,7 @@ mod tests { .unwrap(); let logical_agg = plan.as_logical_agg().unwrap(); - let agg_calls = logical_agg.agg_calls().to_vec(); + let agg_calls = logical_agg.agg_calls().clone(); let group_key = logical_agg.group_key().clone(); (exprs, agg_calls, group_key) diff --git a/src/frontend/src/optimizer/plan_node/logical_apply.rs b/src/frontend/src/optimizer/plan_node/logical_apply.rs index 978cbbcc30122..03ae49fd44406 100644 --- a/src/frontend/src/optimizer/plan_node/logical_apply.rs +++ b/src/frontend/src/optimizer/plan_node/logical_apply.rs @@ -168,7 +168,7 @@ impl LogicalApply { } pub fn correlated_indices(&self) -> Vec { - self.correlated_indices.to_owned() + self.correlated_indices.clone() } pub fn translated(&self) -> bool { diff --git a/src/frontend/src/optimizer/plan_node/logical_kafka_scan.rs b/src/frontend/src/optimizer/plan_node/logical_kafka_scan.rs index 035d7443b2bf6..ffed0efee2832 100644 --- a/src/frontend/src/optimizer/plan_node/logical_kafka_scan.rs +++ b/src/frontend/src/optimizer/plan_node/logical_kafka_scan.rs @@ -63,7 +63,7 @@ impl LogicalKafkaScan { }; if let Some(exprs) = &logical_source.output_exprs { - LogicalProject::create(kafka_scan.into(), exprs.to_vec()) + LogicalProject::create(kafka_scan.into(), exprs.clone()) } else { kafka_scan.into() } diff --git a/src/frontend/src/optimizer/plan_node/logical_project_set.rs b/src/frontend/src/optimizer/plan_node/logical_project_set.rs index 7f099acf4a808..0992b9d076457 100644 --- a/src/frontend/src/optimizer/plan_node/logical_project_set.rs +++ b/src/frontend/src/optimizer/plan_node/logical_project_set.rs @@ -274,7 +274,7 @@ impl ColPrunable for LogicalProjectSet { new_node } else { // projected_row_id column is not needed so we did a projection to remove it - let mut new_output_cols = required_cols.to_vec(); + let mut new_output_cols = required_cols.clone(); if !required_cols.contains(&0) { new_output_cols.insert(0, 0); } diff --git a/src/frontend/src/optimizer/plan_node/logical_scan.rs b/src/frontend/src/optimizer/plan_node/logical_scan.rs index 1041986a4c5e5..af64bd2a5163c 100644 --- a/src/frontend/src/optimizer/plan_node/logical_scan.rs +++ b/src/frontend/src/optimizer/plan_node/logical_scan.rs @@ -324,7 +324,7 @@ impl LogicalScan { predicate = predicate.rewrite_expr(&mut inverse_mapping); let scan_without_predicate = generic::TableScan::new( - self.required_col_idx().to_vec(), + self.required_col_idx().clone(), self.core.table_catalog.clone(), self.table_indexes().to_vec(), self.vector_indexes().to_vec(), @@ -342,7 +342,7 @@ impl LogicalScan { fn clone_with_predicate(&self, predicate: Condition) -> Self { generic::TableScan::new_inner( - self.output_col_idx().to_vec(), + self.output_col_idx().clone(), self.table().clone(), self.table_indexes().to_vec(), self.vector_indexes().to_vec(), diff --git a/src/frontend/src/optimizer/plan_node/logical_source.rs b/src/frontend/src/optimizer/plan_node/logical_source.rs index 0e986187f550d..b3dd1ef46cba3 100644 --- a/src/frontend/src/optimizer/plan_node/logical_source.rs +++ b/src/frontend/src/optimizer/plan_node/logical_source.rs @@ -319,7 +319,7 @@ impl ToBatch for LogicalSource { let mut plan = BatchSource::new(self.core.clone()).into(); if let Some(exprs) = &self.output_exprs { - let logical_project = generic::Project::new(exprs.to_vec(), plan); + let logical_project = generic::Project::new(exprs.clone(), plan); plan = BatchProject::new(logical_project).into(); } @@ -353,7 +353,7 @@ impl ToStream for LogicalSource { } if let Some(exprs) = &self.output_exprs { - let logical_project = generic::Project::new(exprs.to_vec(), plan); + let logical_project = generic::Project::new(exprs.clone(), plan); plan = StreamProject::new(logical_project).into(); } diff --git a/src/frontend/src/optimizer/rule/over_window_to_topn_rule.rs b/src/frontend/src/optimizer/rule/over_window_to_topn_rule.rs index 387539fccb662..6d2e045cd139b 100644 --- a/src/frontend/src/optimizer/rule/over_window_to_topn_rule.rs +++ b/src/frontend/src/optimizer/rule/over_window_to_topn_rule.rs @@ -122,7 +122,7 @@ impl Rule for OverWindowToTopNRule { offset, with_ties, Order { - column_orders: window_func.order_by.to_vec(), + column_orders: window_func.order_by.clone(), }, window_func.partition_by.iter().map(|i| i.index).collect(), ) diff --git a/src/frontend/src/scheduler/distributed/stage.rs b/src/frontend/src/scheduler/distributed/stage.rs index 81b08d1d59c2f..638e9c6ac9907 100644 --- a/src/frontend/src/scheduler/distributed/stage.rs +++ b/src/frontend/src/scheduler/distributed/stage.rs @@ -720,7 +720,7 @@ impl StageRunner { async fn schedule_tasks_for_all(&mut self, shutdown_rx: ShutdownToken) -> SchedulerResult<()> { let expr_context = ExprContext { - time_zone: self.ctx.session().config().timezone().to_owned(), + time_zone: self.ctx.session().config().timezone().clone(), strict_mode: self.ctx.session().config().batch_expr_strict_mode(), }; // If root, we execute it locally. diff --git a/src/frontend/src/scheduler/plan_fragmenter.rs b/src/frontend/src/scheduler/plan_fragmenter.rs index 58d37c1bdbabd..76aa713b01273 100644 --- a/src/frontend/src/scheduler/plan_fragmenter.rs +++ b/src/frontend/src/scheduler/plan_fragmenter.rs @@ -855,7 +855,7 @@ impl StageGraph { .as_ref() .unwrap() .clone() - .complete(self.batch_parallelism, timezone.to_owned()) + .complete(self.batch_parallelism, timezone.clone()) .await?; // For batch reading file source, the number of files involved is typically large. @@ -930,7 +930,7 @@ impl StageGraph { complete_stages, catalog_reader, worker_node_manager, - timezone.to_owned(), + timezone.clone(), ) .await?; } @@ -1027,7 +1027,7 @@ impl BatchPlanFragmenter { .complete( &self.catalog_reader, &self.worker_node_manager, - self.timezone.to_owned(), + self.timezone.clone(), ) .await?; Ok(Query { @@ -1311,7 +1311,7 @@ impl BatchPlanFragmenter { Ok(Some(TableScanInfo::system_table(name))) } else if let Some(scan_node) = node.as_batch_log_seq_scan() { build_table_scan_info( - scan_node.core().table_name.to_owned(), + scan_node.core().table_name.clone(), &scan_node.core().table, &[], ) diff --git a/src/frontend/src/utils/condition.rs b/src/frontend/src/utils/condition.rs index df2b67de42004..796fe84e4bf38 100644 --- a/src/frontend/src/utils/condition.rs +++ b/src/frontend/src/utils/condition.rs @@ -468,9 +468,9 @@ impl Condition { let bound = { if (cmp.is_le() && left_bound) || (cmp.is_ge() && !left_bound) { - left_scan_range.to_vec() + left_scan_range.clone() } else { - right_scan_range.to_vec() + right_scan_range.clone() } }; diff --git a/src/java_binding/src/bin/data-chunk-payload-generator.rs b/src/java_binding/src/bin/data-chunk-payload-generator.rs index 02378d87fbf5d..0b3721ba6f73a 100644 --- a/src/java_binding/src/bin/data-chunk-payload-generator.rs +++ b/src/java_binding/src/bin/data-chunk-payload-generator.rs @@ -28,7 +28,7 @@ fn build_row(index: usize) -> OwnedRow { row_value.push(Some(ScalarImpl::Int64(index as i64))); row_value.push(Some(ScalarImpl::Float32(F32::from(index as f32)))); row_value.push(Some(ScalarImpl::Float64(F64::from(index as f64)))); - row_value.push(Some(ScalarImpl::Bool(index % 3 == 0))); + row_value.push(Some(ScalarImpl::Bool(index.is_multiple_of(3)))); row_value.push(Some(ScalarImpl::Utf8( format!("{}", index).repeat((index % 10) + 1).into(), ))); @@ -36,7 +36,7 @@ fn build_row(index: usize) -> OwnedRow { Timestamp::from_timestamp_uncheck(index as _, 0), ))); row_value.push(Some(ScalarImpl::Decimal(index.into()))); - row_value.push(if index % 5 == 0 { + row_value.push(if index.is_multiple_of(5) { None } else { Some(ScalarImpl::Int64(index as i64)) diff --git a/src/license/src/lib.rs b/src/license/src/lib.rs index 9559ec7339e4f..233e9d61a51d6 100644 --- a/src/license/src/lib.rs +++ b/src/license/src/lib.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] - mod cpu; mod feature; mod key; diff --git a/src/meta/node/src/lib.rs b/src/meta/node/src/lib.rs index 4bf8cca7587a1..39328895a1165 100644 --- a/src/meta/node/src/lib.rs +++ b/src/meta/node/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] #![feature(coverage_attribute)] mod server; @@ -327,7 +326,7 @@ pub fn start( }); let add_info = AddressInfo { - advertise_addr: opts.advertise_addr.to_owned(), + advertise_addr: opts.advertise_addr.clone(), listen_addr, prometheus_addr, dashboard_addr, diff --git a/src/meta/service/src/lib.rs b/src/meta/service/src/lib.rs index 5f1b1f36b12f0..4a9261ae9eed9 100644 --- a/src/meta/service/src/lib.rs +++ b/src/meta/service/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] #![feature(impl_trait_in_assoc_type)] #![feature(coverage_attribute)] diff --git a/src/meta/src/backup_restore/restore.rs b/src/meta/src/backup_restore/restore.rs index 2edb7fccfa9b5..7ce36f6cba6dc 100644 --- a/src/meta/src/backup_restore/restore.rs +++ b/src/meta/src/backup_restore/restore.rs @@ -177,7 +177,7 @@ async fn restore_impl( target_id, &opts, LoaderV2::new(backup_store), - WriterModelV2ToMetaStoreV2::new(meta_store.to_owned()), + WriterModelV2ToMetaStoreV2::new(meta_store), ) .await?; } diff --git a/src/meta/src/controller/scale.rs b/src/meta/src/controller/scale.rs index 21f5fbba7b034..7d418d26cd11b 100644 --- a/src/meta/src/controller/scale.rs +++ b/src/meta/src/controller/scale.rs @@ -149,13 +149,13 @@ fn construct_no_shuffle_traverse_query_helper( ) .to_owned(); - let common_table_expr = CommonTableExpression::new() + let mut common_table_expr = CommonTableExpression::new(); + common_table_expr .query(base_query.union(UnionType::All, cte_referencing).to_owned()) .column(fragment_relation::Column::SourceFragmentId) .column(fragment_relation::Column::DispatcherType) .column(fragment_relation::Column::TargetFragmentId) - .table_name(cte_alias.clone()) - .to_owned(); + .table_name(cte_alias.clone()); SelectStatement::new() .column(fragment_relation::Column::SourceFragmentId) @@ -170,7 +170,6 @@ fn construct_no_shuffle_traverse_query_helper( .cte(common_table_expr) .to_owned(), ) - .to_owned() } #[derive(Debug, Clone)] diff --git a/src/meta/src/controller/utils.rs b/src/meta/src/controller/utils.rs index 2152410787f15..8e27228760b36 100644 --- a/src/meta/src/controller/utils.rs +++ b/src/meta/src/controller/utils.rs @@ -128,7 +128,8 @@ pub fn construct_obj_dependency_query(obj_id: ObjectId) -> WithQuery { ) .to_owned(); - let common_table_expr = CommonTableExpression::new() + let mut common_table_expr = CommonTableExpression::new(); + common_table_expr .query( base_query .union(UnionType::All, belonged_obj_query) @@ -136,8 +137,7 @@ pub fn construct_obj_dependency_query(obj_id: ObjectId) -> WithQuery { .to_owned(), ) .column(cte_return_alias.clone()) - .table_name(cte_alias.clone()) - .to_owned(); + .table_name(cte_alias.clone()); SelectStatement::new() .distinct() @@ -160,7 +160,6 @@ pub fn construct_obj_dependency_query(obj_id: ObjectId) -> WithQuery { .cte(common_table_expr) .to_owned(), ) - .to_owned() } /// This function will construct a query using recursive cte to find if dependent objects are already relying on the target table. @@ -238,14 +237,14 @@ pub fn construct_sink_cycle_check_query( ) .to_owned(); - let common_table_expr = CommonTableExpression::new() + let mut common_table_expr = CommonTableExpression::new(); + common_table_expr .query(base_query.union(UnionType::All, cte_referencing).to_owned()) .columns([ object_dependency::Column::Oid, object_dependency::Column::UsedBy, ]) - .table_name(cte_alias.clone()) - .to_owned(); + .table_name(cte_alias.clone()); SelectStatement::new() .expr(Expr::col((cte_alias.clone(), object_dependency::Column::UsedBy)).count()) @@ -261,7 +260,6 @@ pub fn construct_sink_cycle_check_query( .cte(common_table_expr) .to_owned(), ) - .to_owned() } #[derive(Clone, DerivePartialModel, FromQueryResult, Debug)] @@ -919,14 +917,14 @@ pub fn construct_privilege_dependency_query(ids: Vec) -> WithQuery ) .to_owned(); - let common_table_expr = CommonTableExpression::new() + let mut common_table_expr = CommonTableExpression::new(); + common_table_expr .query(base_query.union(UnionType::All, cte_referencing).to_owned()) .columns([ cte_return_privilege_alias.clone(), cte_return_user_alias.clone(), ]) - .table_name(cte_alias.clone()) - .to_owned(); + .table_name(cte_alias.clone()); SelectStatement::new() .columns([cte_return_privilege_alias, cte_return_user_alias]) @@ -938,7 +936,6 @@ pub fn construct_privilege_dependency_query(ids: Vec) -> WithQuery .cte(common_table_expr) .to_owned(), ) - .to_owned() } pub async fn get_internal_tables_by_id(job_id: ObjectId, db: &C) -> MetaResult> @@ -2037,7 +2034,7 @@ pub fn filter_workers_by_resource_group( .map(|node_label| node_label.as_str() == resource_group) .unwrap_or(false) }) - .map(|(id, _)| (*id as WorkerId)) + .map(|(id, _)| *id as WorkerId) .collect() } diff --git a/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs index 01937bdab0de9..e14f63b083bff 100644 --- a/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/base_level_compaction_picker.rs @@ -283,7 +283,7 @@ impl LevelCompactionPicker { }); // reduce log - if log_counter % 100 == 0 { + if log_counter.is_multiple_of(100) { tracing::warn!( "skip task with level count: {}, file count: {}, select size: {}, target size: {}, target level size: {}", result.input_levels.len(), diff --git a/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs b/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs index c14bed715a18c..a0ec5b52e0a6b 100644 --- a/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs +++ b/src/meta/src/hummock/compaction/picker/min_overlap_compaction_picker.rs @@ -769,7 +769,7 @@ pub mod tests { }, ]; - let levels_handlers = vec![ + let levels_handlers = [ LevelHandler::new(0), LevelHandler::new(1), LevelHandler::new(2), @@ -878,7 +878,7 @@ pub mod tests { }, ]; - let levels_handlers = vec![ + let levels_handlers = [ LevelHandler::new(0), LevelHandler::new(1), LevelHandler::new(2), @@ -1072,7 +1072,7 @@ pub mod tests { }, ]; - let levels_handlers = vec![ + let levels_handlers = [ LevelHandler::new(0), LevelHandler::new(1), LevelHandler::new(2), diff --git a/src/meta/src/hummock/compaction/selector/level_selector.rs b/src/meta/src/hummock/compaction/selector/level_selector.rs index 039575d449fd2..917ba67c245f9 100644 --- a/src/meta/src/hummock/compaction/selector/level_selector.rs +++ b/src/meta/src/hummock/compaction/selector/level_selector.rs @@ -140,7 +140,7 @@ impl DynamicLevelSelectorCore { // TODO: calculate this scores in apply compact result. /// `calculate_level_base_size` calculate base level and the base size of LSM tree build for /// current dataset. In other words, `level_max_bytes` is our compaction goal which shall - /// reach. This algorithm refers to the implementation in [`https://github.com/facebook/rocksdb/blob/v7.2.2/db/version_set.cc#L3706`] + /// reach. This algorithm refers to the implementation in `https://github.com/facebook/rocksdb/blob/v7.2.2/db/version_set.cc#L3706` pub fn calculate_level_base_size(&self, levels: &Levels) -> SelectContext { let mut first_non_empty_level = 0; let mut max_level_size = 0; @@ -350,7 +350,7 @@ impl DynamicLevelSelectorCore { /// `compact_pending_bytes_needed` calculates the number of compact bytes needed to balance the /// LSM Tree from the current state of each level in the LSM Tree in combination with /// `compaction_config` - /// This algorithm refers to the implementation in [`https://github.com/facebook/rocksdb/blob/main/db/version_set.cc#L3141`] + /// This algorithm refers to the implementation in `https://github.com/facebook/rocksdb/blob/main/db/version_set.cc#L3141` pub fn compact_pending_bytes_needed(&self, levels: &Levels) -> u64 { let ctx = self.calculate_level_base_size(levels); self.compact_pending_bytes_needed_with_ctx(levels, &ctx) diff --git a/src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs b/src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs index 4d333a6281150..ec175f95c0b47 100644 --- a/src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs +++ b/src/meta/src/hummock/manager/compaction/compaction_group_schedule.rs @@ -118,7 +118,7 @@ impl HummockManager { let created_tables = if let Some(created_tables) = created_tables { // if the created_tables is provided, use it directly, most for test - assert!(cfg!(debug_assertions)); + const { assert!(cfg!(debug_assertions)) }; created_tables } else { match self.metadata_manager.get_created_table_ids().await { diff --git a/src/meta/src/hummock/model/ext/hummock.rs b/src/meta/src/hummock/model/ext/hummock.rs index fe0b36902e40d..ac2f03bcec9c8 100644 --- a/src/meta/src/hummock/model/ext/hummock.rs +++ b/src/meta/src/hummock/model/ext/hummock.rs @@ -107,7 +107,7 @@ impl Transactional for CompactStatus { #[async_trait::async_trait] impl Transactional for CompactTaskAssignment { async fn upsert_in_transaction(&self, trx: &mut Transaction) -> MetadataModelResult<()> { - let task = self.compact_task.to_owned().unwrap(); + let task = self.compact_task.clone().unwrap(); let m = compaction_task::ActiveModel { id: Set(task.task_id.try_into().unwrap()), context_id: Set(self.context_id.try_into().unwrap()), diff --git a/src/meta/src/lib.rs b/src/meta/src/lib.rs index 311a4e2385caf..54ff29a564f17 100644 --- a/src/meta/src/lib.rs +++ b/src/meta/src/lib.rs @@ -16,8 +16,6 @@ #![feature(trait_alias)] #![feature(type_alias_impl_trait)] #![feature(map_try_insert)] -#![feature(btree_extract_if)] -#![feature(let_chains)] #![feature(error_generic_member_access)] #![feature(assert_matches)] #![feature(try_blocks)] diff --git a/src/meta/src/manager/event_log.rs b/src/meta/src/manager/event_log.rs index 8a134b8ed756f..bd03c9d464a78 100644 --- a/src/meta/src/manager/event_log.rs +++ b/src/meta/src/manager/event_log.rs @@ -149,7 +149,7 @@ impl EventLogManger { self.event_logs .read() .values() - .flat_map(|v| v.iter().map(|e| e.payload.to_owned())) + .flat_map(|v| v.iter().map(|e| e.payload.clone())) .collect() } } diff --git a/src/meta/src/manager/license.rs b/src/meta/src/manager/license.rs index 9ef6077fb9be1..e20c46816f713 100644 --- a/src/meta/src/manager/license.rs +++ b/src/meta/src/manager/license.rs @@ -68,7 +68,7 @@ impl MetaSrvEnv { let updater = { let mgr = self.system_params_manager_impl_ref(); - let path = path.to_path_buf(); + let path = path.clone(); async move { // Let the watcher live until the end of the updater to prevent dropping (then stopping). diff --git a/src/meta/src/stream/stream_graph/fragment.rs b/src/meta/src/stream/stream_graph/fragment.rs index 5f230e4c9524b..9024b6f6f4370 100644 --- a/src/meta/src/stream/stream_graph/fragment.rs +++ b/src/meta/src/stream/stream_graph/fragment.rs @@ -103,7 +103,7 @@ impl BuildingFragment { /// Extract the internal tables from the fragment. fn extract_internal_tables(&self) -> Vec { - let mut fragment = self.inner.to_owned(); + let mut fragment = self.inner.clone(); let mut tables = Vec::new(); stream_graph_visitor::visit_internal_tables(&mut fragment, |table, _| { tables.push(table.clone()); diff --git a/src/object_store/src/lib.rs b/src/object_store/src/lib.rs index b74a6e6095fe3..21b1077275f58 100644 --- a/src/object_store/src/lib.rs +++ b/src/object_store/src/lib.rs @@ -15,6 +15,5 @@ #![feature(trait_alias)] #![feature(type_alias_impl_trait)] #![feature(error_generic_member_access)] -#![feature(let_chains)] pub mod object; diff --git a/src/risedevtool/src/lib.rs b/src/risedevtool/src/lib.rs index c480f6ba7719c..661552c2daebe 100644 --- a/src/risedevtool/src/lib.rs +++ b/src/risedevtool/src/lib.rs @@ -14,7 +14,6 @@ #![allow(clippy::derive_partial_eq_without_eq)] #![feature(exit_status_error)] -#![feature(let_chains)] mod config; pub use config::*; diff --git a/src/rpc_client/src/compactor_client.rs b/src/rpc_client/src/compactor_client.rs index b36a9d80ef3e9..25fdffda1588f 100644 --- a/src/rpc_client/src/compactor_client.rs +++ b/src/rpc_client/src/compactor_client.rs @@ -57,7 +57,7 @@ impl CompactorClient { pub async fn stack_trace(&self, req: StackTraceRequest) -> Result { Ok(self .monitor_client - .to_owned() + .clone() .stack_trace(req) .await .map_err(RpcError::from_compactor_status)? diff --git a/src/rpc_client/src/compute_client.rs b/src/rpc_client/src/compute_client.rs index ff9a89acb8c69..17521d2bcd69c 100644 --- a/src/rpc_client/src/compute_client.rs +++ b/src/rpc_client/src/compute_client.rs @@ -102,7 +102,7 @@ impl ComputeClient { pub async fn get_data(&self, output_id: TaskOutputId) -> Result> { Ok(self .exchange_client - .to_owned() + .clone() .get_data(GetDataRequest { task_output_id: Some(output_id), }) @@ -152,7 +152,7 @@ impl ComputeClient { let response_stream = self .exchange_client - .to_owned() + .clone() .get_stream(request_stream) .await .inspect_err(|_| { @@ -177,7 +177,7 @@ impl ComputeClient { ) -> Result> { Ok(self .task_client - .to_owned() + .clone() .create_task(CreateTaskRequest { task_id: Some(task_id), plan: Some(plan), @@ -192,7 +192,7 @@ impl ComputeClient { pub async fn execute(&self, req: ExecuteRequest) -> Result> { Ok(self .task_client - .to_owned() + .clone() .execute(req) .await .map_err(RpcError::from_compute_status)? @@ -202,7 +202,7 @@ impl ComputeClient { pub async fn cancel(&self, req: CancelTaskRequest) -> Result { Ok(self .task_client - .to_owned() + .clone() .cancel_task(req) .await .map_err(RpcError::from_compute_status)? @@ -212,7 +212,7 @@ impl ComputeClient { pub async fn fast_insert(&self, req: FastInsertRequest) -> Result { Ok(self .task_client - .to_owned() + .clone() .fast_insert(req) .await .map_err(RpcError::from_compute_status)? @@ -222,7 +222,7 @@ impl ComputeClient { pub async fn stack_trace(&self, req: StackTraceRequest) -> Result { Ok(self .monitor_client - .to_owned() + .clone() .stack_trace(req) .await .map_err(RpcError::from_compute_status)? @@ -232,7 +232,7 @@ impl ComputeClient { pub async fn get_streaming_stats(&self) -> Result { Ok(self .monitor_client - .to_owned() + .clone() .get_streaming_stats(GetStreamingStatsRequest::default()) .await .map_err(RpcError::from_compute_status)? @@ -242,7 +242,7 @@ impl ComputeClient { pub async fn profile(&self, sleep_s: u64) -> Result { Ok(self .monitor_client - .to_owned() + .clone() .profiling(ProfilingRequest { sleep_s }) .await .map_err(RpcError::from_compute_status)? @@ -252,7 +252,7 @@ impl ComputeClient { pub async fn heap_profile(&self, dir: String) -> Result { Ok(self .monitor_client - .to_owned() + .clone() .heap_profiling(HeapProfilingRequest { dir }) .await .map_err(RpcError::from_compute_status)? @@ -262,7 +262,7 @@ impl ComputeClient { pub async fn list_heap_profile(&self) -> Result { Ok(self .monitor_client - .to_owned() + .clone() .list_heap_profiling(ListHeapProfilingRequest {}) .await .map_err(RpcError::from_compute_status)? @@ -272,7 +272,7 @@ impl ComputeClient { pub async fn analyze_heap(&self, path: String) -> Result { Ok(self .monitor_client - .to_owned() + .clone() .analyze_heap(AnalyzeHeapRequest { path }) .await .map_err(RpcError::from_compute_status)? @@ -282,7 +282,7 @@ impl ComputeClient { pub async fn show_config(&self) -> Result { Ok(self .config_client - .to_owned() + .clone() .show_config(ShowConfigRequest {}) .await .map_err(RpcError::from_compute_status)? @@ -292,7 +292,7 @@ impl ComputeClient { pub async fn resize_cache(&self, request: ResizeCacheRequest) -> Result { Ok(self .config_client - .to_owned() + .clone() .resize_cache(request) .await .map_err(RpcError::from_compute_status)? diff --git a/src/rpc_client/src/frontend_client.rs b/src/rpc_client/src/frontend_client.rs index 84cbee104aeeb..cb3c061ff3ceb 100644 --- a/src/rpc_client/src/frontend_client.rs +++ b/src/rpc_client/src/frontend_client.rs @@ -109,7 +109,7 @@ impl FrontendRetryClient { Self::get_retry_strategy(), || async { self.client - .to_owned() + .clone() .0 .get_table_replace_plan(request.clone()) .await @@ -123,13 +123,13 @@ impl FrontendRetryClient { &self, request: GetRunningSqlsRequest, ) -> std::result::Result, tonic::Status> { - self.client.0.to_owned().get_running_sqls(request).await + self.client.0.clone().get_running_sqls(request).await } pub async fn cancel_running_sql( &self, request: CancelRunningSqlRequest, ) -> std::result::Result, tonic::Status> { - self.client.0.to_owned().cancel_running_sql(request).await + self.client.0.clone().cancel_running_sql(request).await } } diff --git a/src/rpc_client/src/lib.rs b/src/rpc_client/src/lib.rs index 58f306185dc21..de8707a521cd6 100644 --- a/src/rpc_client/src/lib.rs +++ b/src/rpc_client/src/lib.rs @@ -21,7 +21,6 @@ #![feature(coroutines)] #![feature(iterator_try_collect)] #![feature(try_blocks)] -#![feature(let_chains)] #![feature(impl_trait_in_assoc_type)] #![feature(error_generic_member_access)] #![feature(panic_update_hook)] diff --git a/src/rpc_client/src/meta_client.rs b/src/rpc_client/src/meta_client.rs index 68683aa4e0932..6e45a0727363c 100644 --- a/src/rpc_client/src/meta_client.rs +++ b/src/rpc_client/src/meta_client.rs @@ -2282,7 +2282,7 @@ impl GrpcMetaClient { let members = match strategy { MetaAddressStrategy::LoadBalance(_) => Either::Left(meta_member_client), MetaAddressStrategy::List(addrs) => { - let mut members = LruCache::new(20); + let mut members = LruCache::new(20.try_into().unwrap()); for addr in addrs { members.put(addr.clone(), None); } diff --git a/src/rpc_client/src/stream_client.rs b/src/rpc_client/src/stream_client.rs index 3eceb2d065e3a..fd2c5800d142d 100644 --- a/src/rpc_client/src/stream_client.rs +++ b/src/rpc_client/src/stream_client.rs @@ -91,7 +91,7 @@ impl StreamClient { init_request, )), }; - let mut client = self.0.to_owned(); + let mut client = self.0.clone(); let (handle, first_rsp) = UnboundedBidiStreamHandle::initialize(first_request, |rx| async move { client diff --git a/src/sqlparser/src/lib.rs b/src/sqlparser/src/lib.rs index 07967d4cf75a7..a9b52f82c2d92 100644 --- a/src/sqlparser/src/lib.rs +++ b/src/sqlparser/src/lib.rs @@ -31,7 +31,6 @@ //! ``` #![cfg_attr(not(feature = "std"), no_std)] -#![feature(let_chains)] #![expect(clippy::doc_markdown)] #![expect(clippy::upper_case_acronyms)] #![feature(register_tool)] diff --git a/src/sqlparser/src/parser.rs b/src/sqlparser/src/parser.rs index 57bc6fc4872b5..6152fa5d397a0 100644 --- a/src/sqlparser/src/parser.rs +++ b/src/sqlparser/src/parser.rs @@ -2413,9 +2413,7 @@ impl Parser<'_> { } pub fn parse_with_properties(&mut self) -> ModalResult> { - Ok(self - .parse_options_with_preceding_keyword(Keyword::WITH)? - .to_vec()) + self.parse_options_with_preceding_keyword(Keyword::WITH) } pub fn parse_discard(&mut self) -> ModalResult { diff --git a/src/storage/backup/src/lib.rs b/src/storage/backup/src/lib.rs index 576ff0f93b169..b896f067ff2ff 100644 --- a/src/storage/backup/src/lib.rs +++ b/src/storage/backup/src/lib.rs @@ -17,8 +17,6 @@ #![feature(type_alias_impl_trait)] #![feature(custom_test_frameworks)] #![feature(map_try_insert)] -#![feature(btree_extract_if)] -#![feature(let_chains)] #![feature(error_generic_member_access)] #![feature(coverage_attribute)] diff --git a/src/storage/hummock_sdk/src/lib.rs b/src/storage/hummock_sdk/src/lib.rs index 6c2f0819f5ac4..d8ae3905332f4 100644 --- a/src/storage/hummock_sdk/src/lib.rs +++ b/src/storage/hummock_sdk/src/lib.rs @@ -14,9 +14,7 @@ #![feature(type_alias_impl_trait)] #![feature(impl_trait_in_assoc_type)] -#![feature(let_chains)] #![feature(btree_cursors)] -#![feature(strict_overflow_ops)] #![feature(map_try_insert)] mod key_cmp; diff --git a/src/storage/hummock_test/src/hummock_read_version_tests.rs b/src/storage/hummock_test/src/hummock_read_version_tests.rs index 93b051515899e..6c9b6bdbe24ae 100644 --- a/src/storage/hummock_test/src/hummock_read_version_tests.rs +++ b/src/storage/hummock_test/src/hummock_read_version_tests.rs @@ -73,8 +73,8 @@ async fn test_read_version_basic() { let key = iterator_test_table_key_of(1_usize); let key_range = map_table_key_range(( - Bound::Included(Bytes::from(key.to_vec())), - Bound::Included(Bytes::from(key.to_vec())), + Bound::Included(Bytes::from(key.clone())), + Bound::Included(Bytes::from(key.clone())), )); let (staging_imm_iter, staging_sst_iter) = @@ -111,8 +111,8 @@ async fn test_read_version_basic() { let epoch = test_epoch(e); let key = iterator_test_table_key_of(e as usize); let key_range = map_table_key_range(( - Bound::Included(Bytes::from(key.to_vec())), - Bound::Included(Bytes::from(key.to_vec())), + Bound::Included(Bytes::from(key.clone())), + Bound::Included(Bytes::from(key.clone())), )); let (staging_imm_iter, staging_sst_iter) = read_version diff --git a/src/storage/hummock_trace/src/replay/runner.rs b/src/storage/hummock_trace/src/replay/runner.rs index 56fd10198172c..e2f677458b86d 100644 --- a/src/storage/hummock_trace/src/replay/runner.rs +++ b/src/storage/hummock_trace/src/replay/runner.rs @@ -57,7 +57,7 @@ impl HummockReplay { _ => { worker_scheduler.schedule(r); total_ops += 1; - if total_ops % 10000 == 0 { + if total_ops.is_multiple_of(10000) { println!("replayed {} ops", total_ops); } } diff --git a/src/storage/src/hummock/compactor/iterator.rs b/src/storage/src/hummock/compactor/iterator.rs index 2035a093f9e98..f16e09b9331fb 100644 --- a/src/storage/src/hummock/compactor/iterator.rs +++ b/src/storage/src/hummock/compactor/iterator.rs @@ -592,7 +592,7 @@ impl> HummockIterator for MonitoredCompa self.inner.next().await?; self.processed_key_num += 1; - if self.processed_key_num % PROGRESS_KEY_INTERVAL == 0 { + if self.processed_key_num.is_multiple_of(PROGRESS_KEY_INTERVAL) { self.task_progress .inc_progress_key(PROGRESS_KEY_INTERVAL as _); } diff --git a/src/storage/src/hummock/event_handler/refiller.rs b/src/storage/src/hummock/event_handler/refiller.rs index 04aa3b597235d..d2c56fa583971 100644 --- a/src/storage/src/hummock/event_handler/refiller.rs +++ b/src/storage/src/hummock/event_handler/refiller.rs @@ -742,6 +742,11 @@ impl<'a> Unit<'a> { } fn units(sst: &Sstable, unit: usize) -> usize { - sst.block_count() / unit + if sst.block_count() % unit == 0 { 0 } else { 1 } + sst.block_count() / unit + + if sst.block_count().is_multiple_of(unit) { + 0 + } else { + 1 + } } } diff --git a/src/storage/src/hummock/recent_filter/simple.rs b/src/storage/src/hummock/recent_filter/simple.rs index d5f0859d41901..88d79a3ef5987 100644 --- a/src/storage/src/hummock/recent_filter/simple.rs +++ b/src/storage/src/hummock/recent_filter/simple.rs @@ -55,7 +55,6 @@ impl Clone for SimpleRecentFilter { } impl Inner { - #[expect(clippy::swap_with_temporary)] fn maybe_rotate(&self, force: bool) { if let Some(mut layers) = self.layers.try_write() && (layers.updated.elapsed() >= self.refresh || force) diff --git a/src/storage/src/hummock/shared_buffer/shared_buffer_batch.rs b/src/storage/src/hummock/shared_buffer/shared_buffer_batch.rs index ba751ff5624a4..c1acb23358634 100644 --- a/src/storage/src/hummock/shared_buffer/shared_buffer_batch.rs +++ b/src/storage/src/hummock/shared_buffer/shared_buffer_batch.rs @@ -1445,6 +1445,7 @@ mod tests { } let mut expected = vec![]; + #[expect(clippy::needless_range_loop)] for key_idx in 0..=2 { for epoch in (1..=3).rev() { let item = batch_items[epoch - 1][key_idx].clone(); @@ -1632,6 +1633,7 @@ mod tests { } let mut expected = vec![]; + #[expect(clippy::needless_range_loop)] for key_idx in 0..=2 { for epoch in (1..=3).rev() { let item = batch_items[epoch - 1][key_idx].clone(); diff --git a/src/storage/src/hummock/sstable/block.rs b/src/storage/src/hummock/sstable/block.rs index db3f34f5f5d5a..a1798c39881cb 100644 --- a/src/storage/src/hummock/sstable/block.rs +++ b/src/storage/src/hummock/sstable/block.rs @@ -559,7 +559,7 @@ impl BlockBuilder { true }; - let diff_key = if self.entry_count % self.restart_count == 0 || type_mismatch { + let diff_key = if self.entry_count.is_multiple_of(self.restart_count) || type_mismatch { let offset = utils::checked_into_u32(self.buf.len()).unwrap_or_else(|_| { panic!( "WARN overflow can't convert buf_len {} into u32 table {:?}", diff --git a/src/storage/src/hummock/validator.rs b/src/storage/src/hummock/validator.rs index 538c0ac9c7f3f..4ede03ea9799c 100644 --- a/src/storage/src/hummock/validator.rs +++ b/src/storage/src/hummock/validator.rs @@ -97,7 +97,7 @@ pub async fn validate_ssts(task: ValidationTask, sstable_store: SstableStoreRef) duplicate_worker_id ) } - visited_keys.insert(current_key.to_owned(), (sstable_info.object_id, worker_id)); + visited_keys.insert(current_key.clone(), (sstable_info.object_id, worker_id)); // Ordered and Locally unique if let Some(previous_key) = previous_key.take() { let cmp = previous_key.cmp(¤t_key); diff --git a/src/storage/src/lib.rs b/src/storage/src/lib.rs index f5abd1d60fcef..3a3587e56e256 100644 --- a/src/storage/src/lib.rs +++ b/src/storage/src/lib.rs @@ -24,12 +24,10 @@ #![feature(type_changing_struct_update)] #![test_runner(risingwave_test_runner::test_runner::run_failpont_tests)] #![feature(assert_matches)] -#![feature(btree_extract_if)] #![feature(exact_size_is_empty)] #![feature(coverage_attribute)] #![recursion_limit = "256"] #![feature(error_generic_member_access)] -#![feature(let_chains)] #![feature(impl_trait_in_assoc_type)] #![feature(maybe_uninit_array_assume_init)] #![feature(iter_from_coroutine)] diff --git a/src/storage/src/mem_table.rs b/src/storage/src/mem_table.rs index ff89977825e80..059d73df53b2a 100644 --- a/src/storage/src/mem_table.rs +++ b/src/storage/src/mem_table.rs @@ -23,7 +23,6 @@ use risingwave_common_estimate_size::{EstimateSize, KvSize}; use risingwave_hummock_sdk::key::TableKey; use thiserror::Error; use thiserror_ext::AsReport; -use tracing::error; use crate::hummock::iterator::{Backward, Forward, FromRustIterator, RustIteratorBuilder}; use crate::hummock::shared_buffer::shared_buffer_batch::{SharedBufferBatch, SharedBufferBatchId}; diff --git a/src/stream/benches/stream_hash_join_mem.rs b/src/stream/benches/stream_hash_join_mem.rs index 310764f10d327..8a7b696ad2386 100644 --- a/src/stream/benches/stream_hash_join_mem.rs +++ b/src/stream/benches/stream_hash_join_mem.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] - //! Specify the `amplification_size,workload,join_type` //! ```sh //! ARGS=40000,NotInCache,Inner cargo bench --features dhat-heap --bench stream_hash_join_mem diff --git a/src/stream/benches/stream_hash_join_rt.rs b/src/stream/benches/stream_hash_join_rt.rs index b2bda11d2a8fc..88eb92ae0beb1 100644 --- a/src/stream/benches/stream_hash_join_rt.rs +++ b/src/stream/benches/stream_hash_join_rt.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] - //! To run this benchmark you can use the following command: //! ```sh //! cargo bench --bench stream_hash_join_rt diff --git a/src/stream/src/executor/backfill/cdc/upstream_table/external.rs b/src/stream/src/executor/backfill/cdc/upstream_table/external.rs index 1747b1ac3e5db..b8f65b9b763ed 100644 --- a/src/stream/src/executor/backfill/cdc/upstream_table/external.rs +++ b/src/stream/src/executor/backfill/cdc/upstream_table/external.rs @@ -122,8 +122,8 @@ impl ExternalStorageTable { self.schema.clone(), self.pk_indices.clone(), SchemaTableName { - schema_name: self.schema_name.to_owned(), - table_name: self.table_name.to_owned(), + schema_name: self.schema_name.clone(), + table_name: self.table_name.clone(), }, ) .await diff --git a/src/stream/src/executor/backfill/cdc/upstream_table/snapshot.rs b/src/stream/src/executor/backfill/cdc/upstream_table/snapshot.rs index b539d269cf018..7ee8a6e97331f 100644 --- a/src/stream/src/executor/backfill/cdc/upstream_table/snapshot.rs +++ b/src/stream/src/executor/backfill/cdc/upstream_table/snapshot.rs @@ -381,7 +381,7 @@ mod tests { #[ignore] #[tokio::test] async fn test_mysql_table_reader() { - let columns = vec![ + let columns = [ ColumnDesc::named("o_orderkey", ColumnId::new(1), DataType::Int64), ColumnDesc::named("o_custkey", ColumnId::new(2), DataType::Int64), ColumnDesc::named("o_orderstatus", ColumnId::new(3), DataType::Varchar), diff --git a/src/stream/src/executor/lookup/tests.rs b/src/stream/src/executor/lookup/tests.rs index d4ba2a06e5285..da915bf412cae 100644 --- a/src/stream/src/executor/lookup/tests.rs +++ b/src/stream/src/executor/lookup/tests.rs @@ -141,7 +141,7 @@ async fn create_arrangement(table_id: TableId, memory_state_store: MemoryStateSt /// | - | 6 | 1 | 3 | /// | b | | | 3 -> 4 | fn create_source() -> Executor { - let columns = vec![ + let columns = [ ColumnDesc::named("join_column", 1.into(), DataType::Int64), ColumnDesc::named("rowid_column", 2.into(), DataType::Int64), ]; diff --git a/src/stream/src/executor/source/fs_fetch_executor.rs b/src/stream/src/executor/source/fs_fetch_executor.rs index 9d026ae964d27..58386d8a13f5a 100644 --- a/src/stream/src/executor/source/fs_fetch_executor.rs +++ b/src/stream/src/executor/source/fs_fetch_executor.rs @@ -275,7 +275,7 @@ impl FsFetchExecutor { GLOBAL_ERROR_METRICS.user_source_error.report([ "File source fetch error".to_owned(), core.source_id.to_string(), - core.source_name.to_owned(), + core.source_name.clone(), self.actor_ctx.fragment_id.to_string(), ]); splits_on_fetch = 0; diff --git a/src/stream/src/executor/source/reader_stream.rs b/src/stream/src/executor/source/reader_stream.rs index 302846f9ed4d8..411311ce8fc0c 100644 --- a/src/stream/src/executor/source/reader_stream.rs +++ b/src/stream/src/executor/source/reader_stream.rs @@ -240,7 +240,7 @@ impl StreamReaderBuilder { GLOBAL_ERROR_METRICS.user_source_error.report([ e.variant_name().to_owned(), self.source_id.table_id.to_string(), - self.source_name.to_owned(), + self.source_name.clone(), self.actor_ctx.fragment_id.to_string(), ]); tokio::time::sleep(Duration::from_secs(1)).await; @@ -275,7 +275,7 @@ impl StreamReaderBuilder { GLOBAL_ERROR_METRICS.user_source_error.report([ e.variant_name().to_owned(), self.source_id.table_id.to_string(), - self.source_name.to_owned(), + self.source_name.clone(), self.actor_ctx.fragment_id.to_string(), ]); is_error = true; diff --git a/src/stream/src/executor/source/source_backfill_executor.rs b/src/stream/src/executor/source/source_backfill_executor.rs index bcf54744b4b41..ebd44f34d532e 100644 --- a/src/stream/src/executor/source/source_backfill_executor.rs +++ b/src/stream/src/executor/source/source_backfill_executor.rs @@ -505,7 +505,7 @@ impl SourceBackfillExecutorInner { GLOBAL_ERROR_METRICS.user_source_error.report([ "SourceReaderError".to_owned(), self.source_id.to_string(), - self.source_name.to_owned(), + self.source_name.clone(), self.actor_ctx.fragment_id.to_string(), ]); @@ -1058,10 +1058,8 @@ impl SourceBackfillExecutorInner { states: &mut BackfillStates, should_trim_state: bool, ) -> StreamExecutorResult<()> { - let target_splits: HashSet = target_splits - .into_iter() - .map(|split| (split.id())) - .collect(); + let target_splits: HashSet = + target_splits.into_iter().map(|split| split.id()).collect(); let mut split_changed = false; let mut newly_added_splits = vec![]; diff --git a/src/stream/src/executor/source/source_executor.rs b/src/stream/src/executor/source/source_executor.rs index 19304277a82ec..b3886fb921513 100644 --- a/src/stream/src/executor/source/source_executor.rs +++ b/src/stream/src/executor/source/source_executor.rs @@ -410,7 +410,7 @@ impl SourceExecutor { GLOBAL_ERROR_METRICS.user_source_error.report([ e.variant_name().to_owned(), core.source_id.to_string(), - core.source_name.to_owned(), + core.source_name.clone(), self.actor_ctx.fragment_id.to_string(), ]); diff --git a/src/stream/src/executor/top_n/top_n_plain.rs b/src/stream/src/executor/top_n/top_n_plain.rs index 8bb8c8681a7a5..3f05d1354e07c 100644 --- a/src/stream/src/executor/top_n/top_n_plain.rs +++ b/src/stream/src/executor/top_n/top_n_plain.rs @@ -632,7 +632,7 @@ mod tests { use crate::executor::test_utils::StreamExecutorTestExt; use crate::executor::test_utils::top_n_executor::create_in_memory_state_table_from_state_store; fn create_source_new() -> Executor { - let mut chunks = vec![ + let mut chunks = [ StreamChunk::from_pretty( " I I I I + 1 1 4 1001", @@ -917,7 +917,7 @@ mod tests { use crate::executor::test_utils::top_n_executor::create_in_memory_state_table_from_state_store; fn create_source() -> Executor { - let mut chunks = vec![ + let mut chunks = [ StreamChunk::from_pretty( " I I + 1 0 diff --git a/src/stream/src/executor/top_n/top_n_state.rs b/src/stream/src/executor/top_n/top_n_state.rs index f5baf9cf4aa4b..3bbaac81aeb49 100644 --- a/src/stream/src/executor/top_n/top_n_state.rs +++ b/src/stream/src/executor/top_n/top_n_state.rs @@ -472,7 +472,7 @@ mod tests { let row4_bytes = serialize_pk_to_cache_key(row4.clone(), &cache_key_serde); let row5_bytes = serialize_pk_to_cache_key(row5.clone(), &cache_key_serde); let rows = [row1, row2, row3, row4, row5]; - let ordered_rows = vec![row1_bytes, row2_bytes, row3_bytes, row4_bytes, row5_bytes]; + let ordered_rows = [row1_bytes, row2_bytes, row3_bytes, row4_bytes, row5_bytes]; let mut cache = TopNCache::::new(1, 1, data_types); diff --git a/src/stream/src/executor/watermark_filter.rs b/src/stream/src/executor/watermark_filter.rs index 42254e01dcf2c..28d02f2b1830c 100644 --- a/src/stream/src/executor/watermark_filter.rs +++ b/src/stream/src/executor/watermark_filter.rs @@ -346,7 +346,7 @@ impl WatermarkFilterExecutor { let handle_watermark_row = |watermark_row: Option| match watermark_row { Some(row) => { if row.len() == 1 { - Ok::<_, StreamExecutorError>(row[0].to_owned()) + Ok::<_, StreamExecutorError>(row[0].clone()) } else { bail!("The watermark row should only contain 1 datum"); } diff --git a/src/stream/src/executor/wrapper/update_check.rs b/src/stream/src/executor/wrapper/update_check.rs index de0bb9a51bc25..c6257b542f8bd 100644 --- a/src/stream/src/executor/wrapper/update_check.rs +++ b/src/stream/src/executor/wrapper/update_check.rs @@ -34,7 +34,7 @@ pub async fn update_check(info: Arc, input: impl MessageStream) { for ((op1, row1), (op2, row2)) in once(None) .chain(chunk.rows().map(Some)) .chain(once(None)) - .map(|r| (r.unzip())) + .map(|r| r.unzip()) .tuple_windows() { if (op1.is_none() && op2 == Some(Op::UpdateInsert)) // the first row is U+ diff --git a/src/stream/src/from_proto/asof_join.rs b/src/stream/src/from_proto/asof_join.rs index 066a05e24b454..3d5c3704d3260 100644 --- a/src/stream/src/from_proto/asof_join.rs +++ b/src/stream/src/from_proto/asof_join.rs @@ -68,7 +68,7 @@ impl ExecutorBuilder for AsOfJoinExecutorBuilder { .map(|key| *key as usize) .collect_vec(), ); - let null_safe = node.get_null_safe().to_vec(); + let null_safe = node.get_null_safe().clone(); let output_indices = node .get_output_indices() .iter() diff --git a/src/stream/src/from_proto/hash_join.rs b/src/stream/src/from_proto/hash_join.rs index 42d6181990f80..e9a14839dc762 100644 --- a/src/stream/src/from_proto/hash_join.rs +++ b/src/stream/src/from_proto/hash_join.rs @@ -71,7 +71,7 @@ impl ExecutorBuilder for HashJoinExecutorBuilder { .map(|key| *key as usize) .collect_vec(), ); - let null_safe = node.get_null_safe().to_vec(); + let null_safe = node.get_null_safe().clone(); let output_indices = node .get_output_indices() .iter() diff --git a/src/stream/src/from_proto/temporal_join.rs b/src/stream/src/from_proto/temporal_join.rs index 2b73790577aa2..89b52e60303a0 100644 --- a/src/stream/src/from_proto/temporal_join.rs +++ b/src/stream/src/from_proto/temporal_join.rs @@ -119,7 +119,7 @@ impl ExecutorBuilder for TemporalJoinExecutorBuilder { .map(|key| *key as usize) .collect_vec(); - let null_safe = node.get_null_safe().to_vec(); + let null_safe = node.get_null_safe().clone(); let join_key_data_types = left_join_keys .iter() diff --git a/src/stream/src/lib.rs b/src/stream/src/lib.rs index 3014d746e6c8d..5b6b07faada6a 100644 --- a/src/stream/src/lib.rs +++ b/src/stream/src/lib.rs @@ -17,7 +17,6 @@ #![feature(trait_alias)] #![feature(type_alias_impl_trait)] #![feature(more_qualified_paths)] -#![feature(let_chains)] #![feature(coroutines)] #![feature(iter_from_coroutine)] #![feature(proc_macro_hygiene)] @@ -27,7 +26,6 @@ #![feature(never_type)] #![feature(btreemap_alloc)] #![feature(error_generic_member_access)] -#![feature(btree_extract_if)] #![feature(iter_order_by)] #![feature(exact_size_is_empty)] #![feature(impl_trait_in_assoc_type)] diff --git a/src/tests/compaction_test/src/compaction_test_runner.rs b/src/tests/compaction_test/src/compaction_test_runner.rs index b39a7b60f52a9..10e93958670d3 100644 --- a/src/tests/compaction_test/src/compaction_test_runner.rs +++ b/src/tests/compaction_test/src/compaction_test_runner.rs @@ -404,7 +404,8 @@ async fn start_replay( // We can custom more conditions for compaction triggering // For now I just use a static way here - if replay_count % opts.num_trigger_frequency == 0 && !modified_compaction_groups.is_empty() + if replay_count.is_multiple_of(opts.num_trigger_frequency) + && !modified_compaction_groups.is_empty() { // join previously spawned check result task if let Some(handle) = check_result_task { diff --git a/src/tests/regress/src/lib.rs b/src/tests/regress/src/lib.rs index 57344fee0f62b..5addcf676474b 100644 --- a/src/tests/regress/src/lib.rs +++ b/src/tests/regress/src/lib.rs @@ -25,8 +25,6 @@ #![warn(clippy::no_effect_underscore_binding)] #![warn(clippy::await_holding_lock)] #![deny(rustdoc::broken_intra_doc_links)] -#![feature(path_file_prefix)] -#![feature(let_chains)] #![feature(register_tool)] #![register_tool(rw)] #![allow(rw::format_error)] diff --git a/src/tests/simulation/src/cluster.rs b/src/tests/simulation/src/cluster.rs index 66bab7967288e..d4a4c4b55424f 100644 --- a/src/tests/simulation/src/cluster.rs +++ b/src/tests/simulation/src/cluster.rs @@ -670,7 +670,7 @@ impl Cluster { let rand_nodes = worker_nodes .iter() .choose_multiple(&mut rand::rng(), n) - .to_vec(); + .clone(); Ok(rand_nodes.iter().cloned().cloned().collect_vec()) } diff --git a/src/tests/simulation/src/lib.rs b/src/tests/simulation/src/lib.rs index 159193d5f22a2..034df9b2ee1b6 100644 --- a/src/tests/simulation/src/lib.rs +++ b/src/tests/simulation/src/lib.rs @@ -13,7 +13,6 @@ // limitations under the License. #![feature(trait_alias)] -#![feature(let_chains)] #![feature(try_blocks)] #![feature(register_tool)] #![feature(if_let_guard)] diff --git a/src/tests/simulation/src/utils/timed_future.rs b/src/tests/simulation/src/utils/timed_future.rs index 079850a5c7da4..ef09324b2f40c 100644 --- a/src/tests/simulation/src/utils/timed_future.rs +++ b/src/tests/simulation/src/utils/timed_future.rs @@ -13,7 +13,7 @@ // limitations under the License. use std::future::Future; -use std::pin::{Pin, pin}; +use std::pin::Pin; use std::task::{Context, Poll}; use std::time::{Duration, Instant}; diff --git a/src/tests/sqlsmith/src/lib.rs b/src/tests/sqlsmith/src/lib.rs index e923cf9b00741..be00c7e310c66 100644 --- a/src/tests/sqlsmith/src/lib.rs +++ b/src/tests/sqlsmith/src/lib.rs @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] #![feature(if_let_guard)] #![feature(box_patterns)] #![feature(register_tool)] @@ -176,7 +175,7 @@ pub fn create_table_statement_to_table(statement: &Statement) -> Table { columns.iter().map(|c| c.clone().into()).collect(), pk_indices, *append_only, - source_watermarks.to_vec(), + source_watermarks.clone(), ) } _ => panic!( diff --git a/src/tests/sqlsmith/src/sql_gen/functions.rs b/src/tests/sqlsmith/src/sql_gen/functions.rs index 69349257f5c17..4ca3b6acb08a7 100644 --- a/src/tests/sqlsmith/src/sql_gen/functions.rs +++ b/src/tests/sqlsmith/src/sql_gen/functions.rs @@ -60,7 +60,7 @@ impl SqlGenerator<'_, R> { } /// We do custom generation for the `OVERLAY` function call. - /// See: [`https://github.com/risingwavelabs/risingwave/issues/10695`] for rationale. + /// See: `https://github.com/risingwavelabs/risingwave/issues/10695` for rationale. fn gen_overlay(&mut self, context: SqlGeneratorContext) -> Expr { let expr = Box::new(self.gen_expr(&DataType::Varchar, context)); let new_substring = Box::new(self.gen_expr(&DataType::Varchar, context)); diff --git a/src/tests/sqlsmith/tests/test_runner.rs b/src/tests/sqlsmith/tests/test_runner.rs index 95f30661e44a6..1a4da648ed7b0 100644 --- a/src/tests/sqlsmith/tests/test_runner.rs +++ b/src/tests/sqlsmith/tests/test_runner.rs @@ -12,8 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -#![feature(let_chains)] - #[cfg(feature = "enable_sqlsmith_unit_test")] mod frontend; diff --git a/src/utils/futures_util/src/buffered_with_fence.rs b/src/utils/futures_util/src/buffered_with_fence.rs index 33864beb9b786..a65bd6d437a9c 100644 --- a/src/utils/futures_util/src/buffered_with_fence.rs +++ b/src/utils/futures_util/src/buffered_with_fence.rs @@ -180,11 +180,10 @@ mod tests { } tokio::time::sleep(Duration::from_millis(10 * (n - i) as u64)).await; if is_fence { - let all_later_unpolled = - polled_flags2[(i + 1)..n].iter().cloned().all(|flag| { - let flag = flag.lock().unwrap(); - !*flag - }); + let all_later_unpolled = polled_flags2[(i + 1)..n].iter().all(|flag| { + let flag = flag.lock().unwrap(); + !*flag + }); assert!(all_later_unpolled); } tokio::time::sleep(Duration::from_millis(10 * (n - i) as u64)).await; diff --git a/src/utils/pgwire/src/lib.rs b/src/utils/pgwire/src/lib.rs index 0d68199a5ef3b..8525be4988bf5 100644 --- a/src/utils/pgwire/src/lib.rs +++ b/src/utils/pgwire/src/lib.rs @@ -16,9 +16,7 @@ #![feature(iterator_try_collect)] #![feature(trusted_len)] #![feature(buf_read_has_data_left)] -#![feature(round_char_boundary)] #![feature(never_type)] -#![feature(let_chains)] #![feature(error_generic_member_access)] #![feature(str_as_str)] #![expect(clippy::doc_markdown, reason = "FIXME: later")] diff --git a/src/utils/runtime/src/lib.rs b/src/utils/runtime/src/lib.rs index 937efbc223d01..7859c020a013b 100644 --- a/src/utils/runtime/src/lib.rs +++ b/src/utils/runtime/src/lib.rs @@ -18,7 +18,6 @@ //! environment variables. #![feature(panic_update_hook)] -#![feature(let_chains)] #![feature(exitcode_exit_method)] use std::pin::pin;