From 653d279a890f0284b3e97e3c9bb35f4f2509ba92 Mon Sep 17 00:00:00 2001 From: Ruihang Xia Date: Tue, 9 Aug 2022 18:52:01 +0800 Subject: [PATCH] chore: bump rust toolchain edition to 2021 (#180) * chore: bump rust toolchain edition to 2021 Signed-off-by: Ruihang Xia * remove per crate edition Signed-off-by: Ruihang Xia * bump toolchain to nightly-2022-08-08 Signed-off-by: Ruihang Xia * Revert "remove per crate edition" This reverts commit 8dee2d66732cdce639a2d4187b0b4402f2e7774e. * use workspace edition setting Signed-off-by: Ruihang Xia * also set edition for table_kv component Signed-off-by: Ruihang Xia * make clippy happy Signed-off-by: Ruihang Xia --- Cargo.toml | 6 ++++-- analytic_engine/Cargo.toml | 4 +++- analytic_engine/src/compaction/scheduler.rs | 2 +- analytic_engine/src/instance/alter.rs | 2 +- .../src/instance/flush_compaction.rs | 14 ++++---------- analytic_engine/src/instance/open.rs | 2 +- analytic_engine/src/instance/read.rs | 8 ++++---- analytic_engine/src/instance/write.rs | 2 +- analytic_engine/src/meta/meta_update.rs | 2 +- analytic_engine/src/sst/parquet/reader.rs | 1 + analytic_engine/src/table/version.rs | 14 ++++++++------ analytic_engine/src/table/version_edit.rs | 2 +- analytic_engine/src/table_options.rs | 4 ++-- arrow_deps/Cargo.toml | 4 +++- benchmarks/Cargo.toml | 4 +++- catalog/Cargo.toml | 4 +++- catalog_impls/Cargo.toml | 4 +++- catalog_impls/src/table_based.rs | 13 +++++-------- catalog_impls/src/volatile.rs | 7 ++----- ceresdbproto_deps/Cargo.toml | 4 +++- cluster/Cargo.toml | 4 +++- common_types/Cargo.toml | 4 +++- common_types/src/column_schema.rs | 2 +- common_types/src/string.rs | 2 +- common_util/Cargo.toml | 4 +++- common_util/src/config.rs | 4 ++-- components/arena/Cargo.toml | 4 +++- components/bytes/Cargo.toml | 4 +++- components/logger/Cargo.toml | 4 +++- components/object_store/Cargo.toml | 4 +++- components/parquet/Cargo.toml | 4 +++- components/profile/Cargo.toml | 4 +++- components/skiplist/Cargo.toml | 4 +++- components/skiplist/src/list.rs | 14 +++++++------- components/skiplist/tests/tests.rs | 4 ++-- components/table_kv/Cargo.toml | 4 +++- components/table_kv/src/config.rs | 2 +- components/tracing/Cargo.toml | 4 +++- components/tracing_examples/Cargo.toml | 4 +++- components/tracing_util/Cargo.toml | 4 +++- df_operator/Cargo.toml | 4 +++- grpcio/Cargo.toml | 4 +++- interpreters/Cargo.toml | 4 +++- meta_client/Cargo.toml | 4 +++- meta_client_v2/Cargo.toml | 4 +++- proto/Cargo.toml | 4 +++- query_engine/Cargo.toml | 4 +++- .../src/df_execution_extension/prom_align.rs | 2 +- .../logical_optimizer/order_by_primary_key.rs | 6 +++--- rust-toolchain | 2 +- server/Cargo.toml | 4 +++- sql/Cargo.toml | 4 +++- sql/src/ast.rs | 18 +++++++++--------- system_catalog/Cargo.toml | 4 +++- system_catalog/src/tables.rs | 1 + table_engine/Cargo.toml | 4 +++- table_engine/src/partition/mod.rs | 2 +- table_engine/src/predicate/mod.rs | 2 +- tests/harness/Cargo.toml | 4 +++- tests/harness/src/case.rs | 1 + tests/harness/src/runner.rs | 6 ++---- wal/Cargo.toml | 4 +++- wal/src/table_kv_impl/model.rs | 10 +++++----- wal/src/table_kv_impl/namespace.rs | 4 ++-- wal/src/table_kv_impl/region.rs | 4 ++-- 65 files changed, 178 insertions(+), 119 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0e6df0b629..510e0f0840 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,11 +2,13 @@ name = "ceresdb" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" -resolver = "2" +edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[workspace.package] +edition = "2021" + [workspace] # In alphabetical order members = [ diff --git a/analytic_engine/Cargo.toml b/analytic_engine/Cargo.toml index bf4a43b1bb..e70a0a3f35 100644 --- a/analytic_engine/Cargo.toml +++ b/analytic_engine/Cargo.toml @@ -2,7 +2,9 @@ name = "analytic_engine" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/analytic_engine/src/compaction/scheduler.rs b/analytic_engine/src/compaction/scheduler.rs index 06d60a6a0c..1750aaa3ff 100644 --- a/analytic_engine/src/compaction/scheduler.rs +++ b/analytic_engine/src/compaction/scheduler.rs @@ -381,7 +381,7 @@ impl ScheduleWorker { let table_options = table_data.table_options(); let compaction_strategy = table_options.compaction_strategy; let picker = self.picker_manager.get_picker(compaction_strategy); - let picker_ctx = match new_picker_context(&*table_options) { + let picker_ctx = match new_picker_context(&table_options) { Some(v) => v, None => { warn!("No valid context can be created, compaction request will be ignored, table_id:{}, table_name:{}", diff --git a/analytic_engine/src/instance/alter.rs b/analytic_engine/src/instance/alter.rs index 55e1c84db7..f009acc8f0 100644 --- a/analytic_engine/src/instance/alter.rs +++ b/analytic_engine/src/instance/alter.rs @@ -241,7 +241,7 @@ impl Instance { options ); let mut table_opts = - table_options::merge_table_options_for_alter(&options, &*current_table_options) + table_options::merge_table_options_for_alter(&options, ¤t_table_options) .map_err(|e| Box::new(e) as _) .context(InvalidOptions { space_id: space_table.space().id, diff --git a/analytic_engine/src/instance/flush_compaction.rs b/analytic_engine/src/instance/flush_compaction.rs index be016a9d91..c4a6c4ecc4 100644 --- a/analytic_engine/src/instance/flush_compaction.rs +++ b/analytic_engine/src/instance/flush_compaction.rs @@ -464,12 +464,7 @@ impl Instance { // process sampling memtable and frozen memtable if let Some(sampling_mem) = &mems_to_flush.sampling_mem { if let Some(seq) = self - .dump_sampling_memtable( - &*table_data, - request_id, - sampling_mem, - &mut files_to_level0, - ) + .dump_sampling_memtable(table_data, request_id, sampling_mem, &mut files_to_level0) .await? { flushed_sequence = seq; @@ -481,7 +476,7 @@ impl Instance { } for mem in &mems_to_flush.memtables { let file = self - .dump_normal_memtable(&*table_data, request_id, mem) + .dump_normal_memtable(table_data, request_id, mem) .await?; if let Some(file) = file { let sst_size = file.meta.size; @@ -883,10 +878,9 @@ impl SpaceStore { builder .mut_ssts_of_level(input.level) .extend_from_slice(&input.files); - let merge_iter = builder.build().await.context(BuildMergeIterator { + builder.build().await.context(BuildMergeIterator { table: table_data.name.clone(), - })?; - merge_iter + })? }; let record_batch_stream = if table_options.need_dedup() { diff --git a/analytic_engine/src/instance/open.rs b/analytic_engine/src/instance/open.rs index 43504b9f20..dd2381aaf6 100644 --- a/analytic_engine/src/instance/open.rs +++ b/analytic_engine/src/instance/open.rs @@ -66,7 +66,7 @@ impl Instance { scheduler_config, )); - let file_purger = FilePurger::start(&*bg_runtime, store); + let file_purger = FilePurger::start(&bg_runtime, store); let instance = Arc::new(Instance { space_store, diff --git a/analytic_engine/src/instance/read.rs b/analytic_engine/src/instance/read.rs index bfedd4b3ae..c37a5af25d 100644 --- a/analytic_engine/src/instance/read.rs +++ b/analytic_engine/src/instance/read.rs @@ -99,12 +99,12 @@ impl Instance { if need_merge_sort_streams(&table_data.table_options(), &request) { let merge_iters = self - .build_merge_iters(table_data, &request, iter_options, &*table_options) + .build_merge_iters(table_data, &request, iter_options, &table_options) .await?; self.build_partitioned_streams(&request, merge_iters) } else { let chain_iters = self - .build_chain_iters(table_data, &request, &*table_options) + .build_chain_iters(table_data, &request, &table_options) .await?; self.build_partitioned_streams(&request, chain_iters) } @@ -165,7 +165,7 @@ impl Instance { let time_range = request.predicate.time_range(); let version = table_data.current_version(); - let read_views = self.partition_ssts_and_memtables(time_range, version, &*table_options); + let read_views = self.partition_ssts_and_memtables(time_range, version, table_options); let mut iters = Vec::with_capacity(read_views.len()); for read_view in read_views { @@ -226,7 +226,7 @@ impl Instance { let time_range = request.predicate.time_range(); let version = table_data.current_version(); - let read_views = self.partition_ssts_and_memtables(time_range, version, &*table_options); + let read_views = self.partition_ssts_and_memtables(time_range, version, table_options); let mut iters = Vec::with_capacity(read_views.len()); for read_view in read_views { diff --git a/analytic_engine/src/instance/write.rs b/analytic_engine/src/instance/write.rs index 400b81cb33..9506dea78f 100644 --- a/analytic_engine/src/instance/write.rs +++ b/analytic_engine/src/instance/write.rs @@ -194,7 +194,7 @@ impl Instance { } = encode_ctx; let sequence = self - .write_to_wal(worker_local, &**table_data, encoded_rows) + .write_to_wal(worker_local, table_data, encoded_rows) .await?; Self::write_to_memtable( diff --git a/analytic_engine/src/meta/meta_update.rs b/analytic_engine/src/meta/meta_update.rs index 418f3f6366..bb39302010 100644 --- a/analytic_engine/src/meta/meta_update.rs +++ b/analytic_engine/src/meta/meta_update.rs @@ -250,7 +250,7 @@ impl TryFrom for AddTableMeta { } /// Meta data for dropping a table -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct DropTableMeta { /// Space id of the table pub space_id: SpaceId, diff --git a/analytic_engine/src/sst/parquet/reader.rs b/analytic_engine/src/sst/parquet/reader.rs index dacbf4239c..935b171590 100644 --- a/analytic_engine/src/sst/parquet/reader.rs +++ b/analytic_engine/src/sst/parquet/reader.rs @@ -251,6 +251,7 @@ struct ProjectAndFilterReader { } impl ProjectAndFilterReader { + #[allow(clippy::type_complexity)] fn build_row_group_predicate(&self) -> Box bool + 'static> { assert!(self.file_reader.is_some()); diff --git a/analytic_engine/src/table/version.rs b/analytic_engine/src/table/version.rs index fd5ec3352f..b1ef84af8b 100644 --- a/analytic_engine/src/table/version.rs +++ b/analytic_engine/src/table/version.rs @@ -622,12 +622,14 @@ impl TableVersion { schema_version: schema::Version, ) -> Result> { // Find memtable by timestamp - let mutable = { - let inner = self.inner.read().unwrap(); - match inner.memtable_for_write(write_lock, timestamp) { - Some(v) => v, - None => return Ok(None), - } + let memtable = self + .inner + .read() + .unwrap() + .memtable_for_write(write_lock, timestamp); + let mutable = match memtable { + Some(v) => v, + None => return Ok(None), }; // We consider the schemas are same if they have the same version. diff --git a/analytic_engine/src/table/version_edit.rs b/analytic_engine/src/table/version_edit.rs index affbc4bff5..8e73539499 100644 --- a/analytic_engine/src/table/version_edit.rs +++ b/analytic_engine/src/table/version_edit.rs @@ -90,7 +90,7 @@ impl TryFrom for AddFile { } /// Meta data of the file to delete. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct DeleteFile { /// The level of the file intended to delete. pub level: u16, diff --git a/analytic_engine/src/table_options.rs b/analytic_engine/src/table_options.rs index 4d0926a4ad..500250c8dd 100644 --- a/analytic_engine/src/table_options.rs +++ b/analytic_engine/src/table_options.rs @@ -101,7 +101,7 @@ pub enum Error { define_result!(Error); -#[derive(Debug, Clone, Deserialize, PartialEq)] +#[derive(Debug, Clone, Deserialize, PartialEq, Eq)] pub enum UpdateMode { Overwrite, Append, @@ -128,7 +128,7 @@ impl ToString for UpdateMode { } } -#[derive(Debug, Clone, Copy, Deserialize, PartialEq)] +#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Eq)] pub enum Compression { Uncompressed, Lz4, diff --git a/arrow_deps/Cargo.toml b/arrow_deps/Cargo.toml index 69b62be329..8ee95a3e21 100644 --- a/arrow_deps/Cargo.toml +++ b/arrow_deps/Cargo.toml @@ -2,7 +2,9 @@ name = "arrow_deps" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2021" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 4316a9814b..e5539cdd20 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "benchmarks" version = "0.1.0" -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/catalog/Cargo.toml b/catalog/Cargo.toml index cb26fa5a92..c64d914c7f 100644 --- a/catalog/Cargo.toml +++ b/catalog/Cargo.toml @@ -2,7 +2,9 @@ name = "catalog" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/catalog_impls/Cargo.toml b/catalog_impls/Cargo.toml index e0ceb2e4b6..0a19927db1 100644 --- a/catalog_impls/Cargo.toml +++ b/catalog_impls/Cargo.toml @@ -2,7 +2,9 @@ name = "catalog_impls" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/catalog_impls/src/table_based.rs b/catalog_impls/src/table_based.rs index 1a28906b60..714cae455a 100644 --- a/catalog_impls/src/table_based.rs +++ b/catalog_impls/src/table_based.rs @@ -224,13 +224,10 @@ impl Inner { assert_eq!(1, self.catalogs.len()); // Default catalog is not exists, create and store it. - let default_catalog = self - .create_catalog(CreateCatalogRequest { - catalog_name: consts::DEFAULT_CATALOG.to_string(), - }) - .await?; - - default_catalog + self.create_catalog(CreateCatalogRequest { + catalog_name: consts::DEFAULT_CATALOG.to_string(), + }) + .await? } }; @@ -248,7 +245,7 @@ impl Inner { schema_name: consts::DEFAULT_SCHEMA.to_string(), schema_id, }, - &*catalog, + &catalog, ) .await?; } diff --git a/catalog_impls/src/volatile.rs b/catalog_impls/src/volatile.rs index 68f2ff7cd1..82829e2387 100644 --- a/catalog_impls/src/volatile.rs +++ b/catalog_impls/src/volatile.rs @@ -112,11 +112,8 @@ where Some(v) => v.clone(), None => { // Default catalog is not exists, create and store it. - let default_catalog = self - .create_catalog(consts::DEFAULT_CATALOG.to_string()) - .await; - - default_catalog + self.create_catalog(consts::DEFAULT_CATALOG.to_string()) + .await } }; diff --git a/ceresdbproto_deps/Cargo.toml b/ceresdbproto_deps/Cargo.toml index 10273ce0c1..ad2a227ea8 100644 --- a/ceresdbproto_deps/Cargo.toml +++ b/ceresdbproto_deps/Cargo.toml @@ -2,7 +2,9 @@ name = "ceresdbproto_deps" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/cluster/Cargo.toml b/cluster/Cargo.toml index 33a41fc764..773dc8cba6 100644 --- a/cluster/Cargo.toml +++ b/cluster/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "cluster" version = "0.1.0" -edition = "2021" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common_types/Cargo.toml b/common_types/Cargo.toml index ee6b2949ea..021994313a 100644 --- a/common_types/Cargo.toml +++ b/common_types/Cargo.toml @@ -2,7 +2,9 @@ name = "common_types" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common_types/src/column_schema.rs b/common_types/src/column_schema.rs index 85d8a977a6..29f4e2a1be 100644 --- a/common_types/src/column_schema.rs +++ b/common_types/src/column_schema.rs @@ -133,7 +133,7 @@ impl ToString for ArrowFieldMetaKey { } /// Schema of column -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct ColumnSchema { /// Id of column pub id: ColumnId, diff --git a/common_types/src/string.rs b/common_types/src/string.rs index be41c82702..406d94b5e1 100644 --- a/common_types/src/string.rs +++ b/common_types/src/string.rs @@ -21,7 +21,7 @@ pub type Result = std::result::Result; /// String using [crate::bytes::Bytes] as storage so it can be cast into `Bytes` /// and clone like `Bytes`. -#[derive(Debug, Clone, PartialEq, PartialOrd)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd)] pub struct StringBytes(Bytes); impl StringBytes { diff --git a/common_util/Cargo.toml b/common_util/Cargo.toml index d2c3f3081a..e0f2952b0f 100644 --- a/common_util/Cargo.toml +++ b/common_util/Cargo.toml @@ -2,7 +2,9 @@ name = "common_util" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/common_util/src/config.rs b/common_util/src/config.rs index ac7232767f..56c672d5ab 100644 --- a/common_util/src/config.rs +++ b/common_util/src/config.rs @@ -49,7 +49,7 @@ fn duration_to_ms(d: Duration) -> u64 { d.as_secs() * 1_000 + (nanos / 1_000_000) } -#[derive(Clone, Debug, Copy, PartialEq, PartialOrd, Serialize, Deserialize)] +#[derive(Clone, Debug, Copy, PartialEq, Eq, PartialOrd, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum TimeUnit { Nanoseconds, @@ -126,7 +126,7 @@ impl fmt::Display for TimeUnit { } } -#[derive(Clone, Debug, Copy, PartialEq, PartialOrd)] +#[derive(Clone, Debug, Copy, PartialEq, Eq, PartialOrd)] pub struct ReadableSize(pub u64); impl ReadableSize { diff --git a/components/arena/Cargo.toml b/components/arena/Cargo.toml index ec70993c17..c24ea3639e 100644 --- a/components/arena/Cargo.toml +++ b/components/arena/Cargo.toml @@ -2,7 +2,9 @@ name = "arena" version = "0.1.0" authors = ["Ruihang Xia "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/components/bytes/Cargo.toml b/components/bytes/Cargo.toml index 0fecefbe8e..2562b86e57 100644 --- a/components/bytes/Cargo.toml +++ b/components/bytes/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "bytes" version = "0.1.0" -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/components/logger/Cargo.toml b/components/logger/Cargo.toml index f9281b3eac..d8ab952b09 100644 --- a/components/logger/Cargo.toml +++ b/components/logger/Cargo.toml @@ -2,7 +2,9 @@ name = "logger" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/components/object_store/Cargo.toml b/components/object_store/Cargo.toml index 838f0c0fff..fffa0fbcb3 100644 --- a/components/object_store/Cargo.toml +++ b/components/object_store/Cargo.toml @@ -2,7 +2,9 @@ name = "object_store" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true [dependencies] async-trait = "0.1.53" diff --git a/components/parquet/Cargo.toml b/components/parquet/Cargo.toml index e3fe2a5037..f5273e21e2 100644 --- a/components/parquet/Cargo.toml +++ b/components/parquet/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "parquet" version = "0.1.0" -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/components/profile/Cargo.toml b/components/profile/Cargo.toml index 77e939b41b..057dbce3f0 100644 --- a/components/profile/Cargo.toml +++ b/components/profile/Cargo.toml @@ -2,7 +2,9 @@ name = "profile" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] diff --git a/components/skiplist/Cargo.toml b/components/skiplist/Cargo.toml index f56e48d122..2e9f52e279 100644 --- a/components/skiplist/Cargo.toml +++ b/components/skiplist/Cargo.toml @@ -2,7 +2,9 @@ name = "skiplist" version = "0.1.0" authors = ["Jay Lee "] -edition = "2018" + +[package.edition] +workspace = true [dependencies] rand = "0.7" diff --git a/components/skiplist/src/list.rs b/components/skiplist/src/list.rs index ae84d2c3e7..e2a9d70e19 100644 --- a/components/skiplist/src/list.rs +++ b/components/skiplist/src/list.rs @@ -255,7 +255,7 @@ impl + Clone> Skiplist { let mut level = self.height(); loop { // Assume cursor.key < key - let next_ptr = (&*cursor).next_ptr(level); + let next_ptr = (*cursor).next_ptr(level); if next_ptr.is_null() { // cursor.key < key < END OF LIST if level > 0 { @@ -329,7 +329,7 @@ impl + Clone> Skiplist { ) -> (*mut Node, *mut Node) { loop { // Assume before.key < key - let next_ptr = (&*before).next_ptr(level); + let next_ptr = (*before).next_ptr(level); if next_ptr.is_null() { return (before, ptr::null_mut()); } @@ -439,7 +439,7 @@ impl + Clone> Skiplist { /// Returns if the skiplist is empty pub fn is_empty(&self) -> bool { let node = self.core.head.as_ptr(); - let next_ptr = unsafe { (&*node).next_ptr(0) }; + let next_ptr = unsafe { (*node).next_ptr(0) }; next_ptr.is_null() } @@ -448,7 +448,7 @@ impl + Clone> Skiplist { let mut node = self.core.head.as_ptr(); let mut count = 0; loop { - let next_ptr = unsafe { (&*node).next_ptr(0) }; + let next_ptr = unsafe { (*node).next_ptr(0) }; if !next_ptr.is_null() { count += 1; node = next_ptr; @@ -464,7 +464,7 @@ impl + Clone> Skiplist { let mut node = self.core.head.as_ptr(); let mut level = self.height(); loop { - let next_ptr = unsafe { (&*node).next_ptr(level) }; + let next_ptr = unsafe { (*node).next_ptr(level) }; if !next_ptr.is_null() { node = next_ptr; continue; @@ -570,7 +570,7 @@ impl>, C: KeyComparator, A: Arena + pub fn next(&mut self) { assert!(self.valid()); unsafe { - self.cursor = (&*self.cursor).next_ptr(0); + self.cursor = (*self.cursor).next_ptr(0); } } @@ -595,7 +595,7 @@ impl>, C: KeyComparator, A: Arena + pub fn seek_to_first(&mut self) { unsafe { - self.cursor = (&*self.list.as_ref().core.head.as_ptr()).next_ptr(0); + self.cursor = (*self.list.as_ref().core.head.as_ptr()).next_ptr(0); } } diff --git a/components/skiplist/tests/tests.rs b/components/skiplist/tests/tests.rs index 78a5d81f78..b8e6473341 100644 --- a/components/skiplist/tests/tests.rs +++ b/components/skiplist/tests/tests.rs @@ -54,14 +54,14 @@ fn test_basic() { ]; for (key, value) in &table { - list.put(&key_with_ts(*key, 0), value); + list.put(&key_with_ts(key, 0), value); } assert_eq!(list.get(&key_with_ts("key", 0)), None); assert_eq!(list.len(), 5); assert!(!list.is_empty()); for (key, value) in &table { - let get_key = key_with_ts(*key, 0); + let get_key = key_with_ts(key, 0); assert_eq!(list.get(&get_key), Some(&value[..]), "{}", key); } } diff --git a/components/table_kv/Cargo.toml b/components/table_kv/Cargo.toml index 3b458e16f4..fef7faabdf 100644 --- a/components/table_kv/Cargo.toml +++ b/components/table_kv/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "table_kv" version = "0.1.0" -edition = "2021" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/components/table_kv/src/config.rs b/components/table_kv/src/config.rs index 0bf5d14ace..d97d319d1e 100644 --- a/components/table_kv/src/config.rs +++ b/components/table_kv/src/config.rs @@ -66,7 +66,7 @@ impl ObkvConfig { } /// Obkv server log level. -#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Debug)] +#[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug)] #[serde(rename_all = "lowercase")] pub enum ObLogLevel { None = 7, diff --git a/components/tracing/Cargo.toml b/components/tracing/Cargo.toml index dc493f02cc..1cf5ac99cd 100644 --- a/components/tracing/Cargo.toml +++ b/components/tracing/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "tracing" version = "0.1.0" -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/components/tracing_examples/Cargo.toml b/components/tracing_examples/Cargo.toml index b8bea30722..6ed91ff20c 100644 --- a/components/tracing_examples/Cargo.toml +++ b/components/tracing_examples/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "trace_examples" version = "0.1.0" -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/components/tracing_util/Cargo.toml b/components/tracing_util/Cargo.toml index 15eb11520a..86f8257627 100644 --- a/components/tracing_util/Cargo.toml +++ b/components/tracing_util/Cargo.toml @@ -4,7 +4,9 @@ version = "0.1.0" authors = ["Databend Authors "] license = "Apache-2.0" publish = false -edition = "2018" + +[package.edition] +workspace = true [dependencies] # In alphabetical order lazy_static = "1.4.0" diff --git a/df_operator/Cargo.toml b/df_operator/Cargo.toml index 7d7f43ce5b..a9973c7450 100644 --- a/df_operator/Cargo.toml +++ b/df_operator/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "df_operator" version = "0.1.0" -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/grpcio/Cargo.toml b/grpcio/Cargo.toml index 8d5d643ac0..870f66d3ed 100644 --- a/grpcio/Cargo.toml +++ b/grpcio/Cargo.toml @@ -2,7 +2,9 @@ name = "grpcio" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/interpreters/Cargo.toml b/interpreters/Cargo.toml index 703ed69baa..cca2ba6745 100644 --- a/interpreters/Cargo.toml +++ b/interpreters/Cargo.toml @@ -2,7 +2,9 @@ name = "interpreters" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/meta_client/Cargo.toml b/meta_client/Cargo.toml index e009de85f7..6a55e41ca7 100644 --- a/meta_client/Cargo.toml +++ b/meta_client/Cargo.toml @@ -2,7 +2,9 @@ name = "meta_client" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/meta_client_v2/Cargo.toml b/meta_client_v2/Cargo.toml index 9631011158..e0ccc95a30 100644 --- a/meta_client_v2/Cargo.toml +++ b/meta_client_v2/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "meta_client_v2" version = "0.1.0" -edition = "2021" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/proto/Cargo.toml b/proto/Cargo.toml index 456ffa9771..6999e302ae 100644 --- a/proto/Cargo.toml +++ b/proto/Cargo.toml @@ -2,7 +2,9 @@ name = "proto" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/query_engine/Cargo.toml b/query_engine/Cargo.toml index c72d830d24..52c742b9ac 100644 --- a/query_engine/Cargo.toml +++ b/query_engine/Cargo.toml @@ -2,7 +2,9 @@ name = "query_engine" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/query_engine/src/df_execution_extension/prom_align.rs b/query_engine/src/df_execution_extension/prom_align.rs index 56d8acadc9..9d0b32dc8e 100644 --- a/query_engine/src/df_execution_extension/prom_align.rs +++ b/query_engine/src/df_execution_extension/prom_align.rs @@ -75,7 +75,7 @@ impl fmt::Display for ExtractTsidExpr { impl PhysicalExpr for ExtractTsidExpr { fn as_any(&self) -> &dyn Any { - &*self + self } fn data_type(&self, _input_schema: &ArrowSchema) -> ArrowResult { diff --git a/query_engine/src/logical_optimizer/order_by_primary_key.rs b/query_engine/src/logical_optimizer/order_by_primary_key.rs index ade885b001..122fa55da0 100644 --- a/query_engine/src/logical_optimizer/order_by_primary_key.rs +++ b/query_engine/src/logical_optimizer/order_by_primary_key.rs @@ -330,7 +330,7 @@ mod tests { let rule = OrderByPrimaryKeyRule; let optimized_plan = rule - .do_optimize(&*plan) + .do_optimize(&plan) .expect("Optimize plan") .expect("Succeed to optimize plan"); let expected_plan = { @@ -394,7 +394,7 @@ mod tests { }; let rule = OrderByPrimaryKeyRule; - let optimized_plan = rule.do_optimize(&*plan).expect("Optimize plan"); + let optimized_plan = rule.do_optimize(&plan).expect("Optimize plan"); assert!(optimized_plan.is_none()); } @@ -411,7 +411,7 @@ mod tests { }; let rule = OrderByPrimaryKeyRule; - let optimized_plan = rule.do_optimize(&*plan).expect("Optimize plan"); + let optimized_plan = rule.do_optimize(&plan).expect("Optimize plan"); assert!(optimized_plan.is_none()); } } diff --git a/rust-toolchain b/rust-toolchain index 58d0130e05..51a91a0711 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2022-01-06 +nightly-2022-08-08 diff --git a/server/Cargo.toml b/server/Cargo.toml index 7a65bb47a3..8538edc027 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -2,7 +2,9 @@ name = "server" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/sql/Cargo.toml b/sql/Cargo.toml index d1fe01af07..1e0119198c 100644 --- a/sql/Cargo.toml +++ b/sql/Cargo.toml @@ -2,7 +2,9 @@ name = "sql" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/sql/src/ast.rs b/sql/src/ast.rs index 1084884c22..304a8d1ef5 100644 --- a/sql/src/ast.rs +++ b/sql/src/ast.rs @@ -7,7 +7,7 @@ use sqlparser::ast::{ }; /// Statement representations -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub enum Statement { /// ANSI SQL AST node Standard(Box), @@ -26,7 +26,7 @@ pub enum Statement { Exists(ExistsTable), } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct TableName(ObjectName); impl TableName { @@ -58,7 +58,7 @@ pub enum ShowCreateObject { Table, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct CreateTable { /// Create if not exists pub if_not_exists: bool, @@ -71,7 +71,7 @@ pub struct CreateTable { pub options: Vec, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct DropTable { /// Table name pub table_name: TableName, @@ -79,30 +79,30 @@ pub struct DropTable { pub engine: String, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct DescribeTable { pub table_name: TableName, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct AlterModifySetting { pub table_name: TableName, pub options: Vec, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct AlterAddColumn { pub table_name: TableName, pub columns: Vec, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct ShowCreate { pub obj_type: ShowCreateObject, pub table_name: TableName, } -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Eq)] pub struct ExistsTable { pub table_name: TableName, } diff --git a/system_catalog/Cargo.toml b/system_catalog/Cargo.toml index 72533ea5ef..f55f82f01f 100644 --- a/system_catalog/Cargo.toml +++ b/system_catalog/Cargo.toml @@ -2,7 +2,9 @@ name = "system_catalog" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/system_catalog/src/tables.rs b/system_catalog/src/tables.rs index 9b507313db..b3f90a1c19 100644 --- a/system_catalog/src/tables.rs +++ b/system_catalog/src/tables.rs @@ -103,6 +103,7 @@ impl Tables { } } + #[allow(clippy::wrong_self_convention)] fn from_table(&self, catalog: CatalogRef, schema: SchemaRef, table: TableRef) -> Row { let mut datums = Vec::with_capacity(self.schema.num_columns()); datums.push(Datum::Timestamp(ENTRY_TIMESTAMP)); diff --git a/table_engine/Cargo.toml b/table_engine/Cargo.toml index c8575300e2..510946c7a7 100644 --- a/table_engine/Cargo.toml +++ b/table_engine/Cargo.toml @@ -2,7 +2,9 @@ name = "table_engine" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/table_engine/src/partition/mod.rs b/table_engine/src/partition/mod.rs index e419b3ef72..042dd3c672 100644 --- a/table_engine/src/partition/mod.rs +++ b/table_engine/src/partition/mod.rs @@ -6,7 +6,7 @@ mod expression; pub mod rule; /// Partition type of table -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum PartitionType { None = 0, Hash = 1, diff --git a/table_engine/src/predicate/mod.rs b/table_engine/src/predicate/mod.rs index 9304230521..80e1c50520 100644 --- a/table_engine/src/predicate/mod.rs +++ b/table_engine/src/predicate/mod.rs @@ -446,7 +446,7 @@ impl<'a> TimeRangeExtractor<'a> { } => { if let Expr::Column(column) = expr.as_ref() { if column.name == self.timestamp_column_name { - return Self::time_range_from_between_expr(&*low, &*high, *negated); + return Self::time_range_from_between_expr(low, high, *negated); } } diff --git a/tests/harness/Cargo.toml b/tests/harness/Cargo.toml index 03ad5e7250..0b93f65fb9 100644 --- a/tests/harness/Cargo.toml +++ b/tests/harness/Cargo.toml @@ -1,7 +1,9 @@ [package] name = "ceresdb-test" version = "0.1.0" -edition = "2021" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/tests/harness/src/case.rs b/tests/harness/src/case.rs index 85d238abd9..b15e05c13a 100644 --- a/tests/harness/src/case.rs +++ b/tests/harness/src/case.rs @@ -142,6 +142,7 @@ impl Query { .fold(String::new(), |query, str| query + " " + str) } + #[allow(clippy::unused_io_amount)] async fn write_result(&self, writer: &mut W, result: String) -> Result<()> where W: AsyncWrite + Unpin, diff --git a/tests/harness/src/runner.rs b/tests/harness/src/runner.rs index 36c9ed80be..2fa80f2be9 100644 --- a/tests/harness/src/runner.rs +++ b/tests/harness/src/runner.rs @@ -60,10 +60,8 @@ impl Runner { } println!( - "Takes {:?}. Diff: {}. Test case {:?} finished.", - elapsed, - is_different, - case.to_string() + "Takes {:?}. Diff: {}. Test case {} finished.", + elapsed, is_different, case ); }; diff --git a/wal/Cargo.toml b/wal/Cargo.toml index 4b1fbf6bad..96cd57d292 100644 --- a/wal/Cargo.toml +++ b/wal/Cargo.toml @@ -2,7 +2,9 @@ name = "wal" version = "0.1.0" authors = ["CeresDB Authors "] -edition = "2018" + +[package.edition] +workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/wal/src/table_kv_impl/model.rs b/wal/src/table_kv_impl/model.rs index 4b399dab83..726f565523 100644 --- a/wal/src/table_kv_impl/model.rs +++ b/wal/src/table_kv_impl/model.rs @@ -150,7 +150,7 @@ fn encode_json(value: &T) -> Result> { } /// Data of wal shards. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(default)] pub struct WalShardEntry { /// Whether ttl of wal shard is enabled. @@ -172,7 +172,7 @@ impl Default for WalShardEntry { } /// Data of region meta tables. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(default)] pub struct RegionMetaEntry { /// Hash shard num of region meta tables. @@ -188,7 +188,7 @@ impl Default for RegionMetaEntry { } /// Data of a wal namespace, which is similar to a wal directory. -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(default)] pub struct NamespaceEntry { /// Name of namespace. @@ -325,7 +325,7 @@ impl Default for NamespaceConfig { /// Contains all wal shards of given time range, region is routed to a specific /// shard by its region id. -#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] #[serde(default)] pub struct BucketEntry { /// Shard number of the bucket. @@ -431,7 +431,7 @@ impl BucketEntry { } /// Meta data of a region. -#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] #[serde(default)] pub struct RegionEntry { #[serde(with = "format_string")] diff --git a/wal/src/table_kv_impl/namespace.rs b/wal/src/table_kv_impl/namespace.rs index d7023710e4..6286b3a25b 100644 --- a/wal/src/table_kv_impl/namespace.rs +++ b/wal/src/table_kv_impl/namespace.rs @@ -924,7 +924,7 @@ impl Namespace { // Has ttl, we need to periodically create/purge buckets. monitor_handle = Some(start_bucket_monitor( - &*runtimes.bg_runtime, + &runtimes.bg_runtime, BUCKET_MONITOR_PERIOD, inner.clone(), )); @@ -933,7 +933,7 @@ impl Namespace { // Start a cleaner if wal has no ttl. cleaner_handle = Some(start_log_cleaner( - &*runtimes.bg_runtime, + &runtimes.bg_runtime, LOG_CLEANER_PERIOD, inner.clone(), )); diff --git a/wal/src/table_kv_impl/region.rs b/wal/src/table_kv_impl/region.rs index f976d02c1a..a84ea0abe6 100644 --- a/wal/src/table_kv_impl/region.rs +++ b/wal/src/table_kv_impl/region.rs @@ -265,7 +265,7 @@ impl Region { let mut writer = self.writer.lock().await; writer .write_log( - &*self.runtimes.write_runtime, + &self.runtimes.write_runtime, table_kv, &self.state, bucket, @@ -328,7 +328,7 @@ impl Region { let mut writer = self.writer.lock().await; writer .delete_entries_up_to( - &*self.runtimes.write_runtime, + &self.runtimes.write_runtime, table_kv, &self.state, region_meta_table,