chore: update rust toolchain to 2026-03-21

This commit is contained in:
Ning Sun
2026-03-23 21:43:49 +08:00
parent 805536aed1
commit 1d95a042e1
185 changed files with 288 additions and 381 deletions

12
Cargo.lock generated
View File

@@ -6283,7 +6283,7 @@ dependencies = [
"js-sys",
"log",
"wasm-bindgen",
"windows-core 0.61.2",
"windows-core 0.57.0",
]
[[package]]
@@ -11346,9 +11346,9 @@ dependencies = [
[[package]]
name = "rsasl"
version = "2.2.0"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8b534a23662bb559c5c73213be63ecd6524e774d291f3618c2b04b723d184eb"
checksum = "9f1bcb95b531681a622f3d6972eaab523e17e2aad6d6209f0276628eb1cb5038"
dependencies = [
"base64 0.22.1",
"core2",
@@ -11360,7 +11360,7 @@ dependencies = [
"serde_json",
"sha2",
"stringprep",
"thiserror 1.0.69",
"thiserror 2.0.17",
]
[[package]]
@@ -12347,9 +12347,9 @@ dependencies = [
[[package]]
name = "slab"
version = "0.4.10"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d"
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "slotmap"

View File

@@ -20,7 +20,7 @@
lib = nixpkgs.lib;
rustToolchain = fenix.packages.${system}.fromToolchainName {
name = (lib.importTOML ./rust-toolchain.toml).toolchain.channel;
sha256 = "sha256-GCGEXGZeJySLND0KU5TdtTrqFV76TF3UdvAHSUegSsk=";
sha256 = "sha256-rboGKQLH4eDuiY01SINOqmXUFUNr9F4awoFZGzib17o=";
};
in
{

View File

@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2025-10-01"
channel = "nightly-2026-03-21"

View File

@@ -12,8 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use api::v1::greptime_request::Request;

View File

@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
#![feature(try_blocks)]
use std::any::Any;

View File

@@ -148,9 +148,7 @@ impl CatalogManager for MemoryCatalogManager {
Ok(self
.catalogs
.read()
.unwrap()
.iter()
.flat_map(|(_, schema_entries)| schema_entries.values())
.unwrap().values().flat_map(|schema_entries| schema_entries.values())
.flat_map(|tables| tables.values())
.find(|t| t.table_info().ident.table_id == table_id)
.map(|t| t.table_info()))

View File

@@ -372,22 +372,16 @@ impl InformationSchemaTablesBuilder {
self.table_types.push(Some(table_type_text));
self.table_ids.push(Some(table_id));
let data_length = region_stats.iter().map(|stat| stat.sst_size).sum();
let table_rows = region_stats.iter().map(|stat| stat.num_rows).sum();
let index_length = region_stats.iter().map(|stat| stat.index_size).sum();
let data_length: u64 = region_stats.iter().map(|stat| stat.sst_size).sum();
let table_rows: u64 = region_stats.iter().map(|stat| stat.num_rows).sum();
let index_length: u64 = region_stats.iter().map(|stat| stat.index_size).sum();
// It's not precise, but it is acceptable for long-term data storage.
let avg_row_length = if table_rows > 0 {
let total_data_length = data_length
+ region_stats
.iter()
.map(|stat| stat.memtable_size)
.sum::<u64>();
total_data_length / table_rows
} else {
0
};
let total_data_length: u64 = data_length
+ region_stats
.iter()
.map(|stat| stat.memtable_size)
.sum::<u64>();
let avg_row_length = total_data_length.checked_div(table_rows).unwrap_or(0);
self.data_length.push(Some(data_length));
self.index_length.push(Some(index_length));

View File

@@ -74,12 +74,10 @@ impl PGCatalogProvider {
)
.expect("Failed to initialize PgCatalogSchemaProvider");
let mut table_ids = HashMap::new();
let mut table_id = PG_CATALOG_TABLE_ID_START;
for name in PG_CATALOG_TABLES {
table_ids.insert(*name, table_id);
table_id += 1;
}
let table_ids: HashMap<_, _> = (PG_CATALOG_TABLE_ID_START..)
.zip(PG_CATALOG_TABLES.iter())
.map(|(id, name)| (*name, id))
.collect();
let mut provider = Self {
catalog_name,

View File

@@ -191,7 +191,7 @@ impl DfTableSourceProvider {
plan_columns
.iter()
.map(|c| c.as_str())
.zip(columns.into_iter())
.zip(columns)
.collect(),
)
.context(ProjectViewColumnsSnafu)?

View File

@@ -458,8 +458,10 @@ impl Export {
/// build operator with preference for file system
async fn build_prefer_fs_operator(&self) -> Result<ObjectStore> {
if self.storage_type.is_remote_storage() && self.ddl_local_dir.is_some() {
let root = self.ddl_local_dir.as_ref().unwrap().clone();
if self.storage_type.is_remote_storage()
&& let Some(ddl_local_dir) = &self.ddl_local_dir
{
let root = ddl_local_dir.clone();
let op = new_fs_object_store(&root).map_err(|e| Error::Other {
source: e,
location: snafu::location!(),

View File

@@ -512,7 +512,7 @@ struct FlightContext {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use api::v1::auth_header::AuthScheme;
use api::v1::{AuthHeader, Basic};

View File

@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
mod client;
pub mod client_manager;
pub mod database;

View File

@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![recursion_limit = "256"]
#![doc = include_str!("../../../../README.md")]
use clap::{Parser, Subcommand};

View File

@@ -356,7 +356,7 @@ impl StartCommand {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::io::Write;
use std::time::Duration;

View File

@@ -662,7 +662,7 @@ impl ScanbenchCommand {
// Sort ranges within each partition by start time ascending
for partition in &mut partitions {
partition.sort_by(|a, b| a.start.cmp(&b.start));
partition.sort_by_key(|a| a.start);
}
scanner

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
#![recursion_limit = "256"]
use async_trait::async_trait;
use common_error::ext::ErrorExt;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;
use std::vec;

View File

@@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
#![feature(type_alias_impl_trait)]
pub mod buffered_writer;
pub mod compressed_writer;
pub mod compression;

View File

@@ -52,7 +52,7 @@ pub enum Error {
#[snafu(display("Failed to invoke list process service"))]
CreateChannel {
source: common_grpc::error::Error,
source: Box<common_grpc::error::Error>,
#[snafu(implicit)]
location: Location,
},

View File

@@ -91,6 +91,7 @@ impl FrontendSelector for MetaClientSelector {
let channel = self
.channel_manager
.get(node.peer.addr)
.map_err(Box::new)
.context(error::CreateChannelSnafu)?;
let client = frontend_client::FrontendClient::new(channel);
Ok(Box::new(client) as FrontendClientPtr)

View File

@@ -13,7 +13,6 @@
// limitations under the License.
#![feature(try_blocks)]
#![feature(assert_matches)]
mod admin;
mod flush_flow;

View File

@@ -794,17 +794,15 @@ impl Tokenizer {
is_quote_present = true;
break;
}
' ' => {
if !is_quoted {
' '
if !is_quoted => {
break;
}
}
'(' | ')' | '+' | '-' => {
if !is_quoted {
'(' | ')' | '+' | '-'
if !is_quoted => {
self.rewind_one();
break;
}
}
'\\' => {
let Some(next) = self.consume_next(pattern) else {
return InvalidFuncArgsSnafu {

View File

@@ -141,7 +141,7 @@ where
results.push((self.func)(v0, v1)?);
}
let results = ScalarValue::iter_to_array(results.into_iter())?;
let results = ScalarValue::iter_to_array(results)?;
Ok(ColumnarValue::Array(results))
}
}
@@ -200,7 +200,7 @@ where
}
}
let results = ScalarValue::iter_to_array(results.into_iter())?;
let results = ScalarValue::iter_to_array(results)?;
Ok(ColumnarValue::Array(results))
}
}
@@ -232,7 +232,7 @@ where
results.push((self.func)(&v)?);
}
let results = ScalarValue::iter_to_array(results.into_iter())?;
let results = ScalarValue::iter_to_array(results)?;
Ok(ColumnarValue::Array(results))
}
}

View File

@@ -167,7 +167,7 @@ mod tests {
"External error: Invalid vector string: [7.0,hello,9.0]",
];
for (input, expected) in inputs.into_iter().zip(expected.into_iter()) {
for (input, expected) in inputs.into_iter().zip(expected) {
let args = ScalarFunctionArgs {
args: vec![ColumnarValue::Array(Arc::new(input))],
arg_fields: vec![],

View File

@@ -303,7 +303,7 @@ impl TryFrom<i32> for Role {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use common_workload::DatanodeWorkloadType;

View File

@@ -72,7 +72,7 @@ impl State for DropDatabaseStart {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use crate::ddl::drop_database::cursor::DropDatabaseCursor;

View File

@@ -322,7 +322,7 @@ impl DropTableExecutor {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;

View File

@@ -19,7 +19,7 @@ pub mod datanode_handler;
pub mod flownode_handler;
pub mod region_metadata;
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use api::v1::meta::Partition;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use api::region::RegionResponse;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;
@@ -256,7 +256,7 @@ async fn test_on_submit_alter_request() {
results.push(result);
}
rx.try_recv().unwrap_err();
results.sort_unstable_by(|(a, _), (b, _)| a.id.cmp(&b.id));
results.sort_unstable_by_key(|(a, _)| a.id);
let (peer, request) = results.remove(0);
assert_alter_request(peer, request, 1, RegionId::new(table_id, 1));
@@ -310,7 +310,7 @@ async fn test_on_submit_alter_request_without_sync_request() {
results.push(result);
}
rx.try_recv().unwrap_err();
results.sort_unstable_by(|(a, _), (b, _)| a.id.cmp(&b.id));
results.sort_unstable_by_key(|(a, _)| a.id);
let (peer, request) = results.remove(0);
assert_alter_request(peer, request, 1, RegionId::new(table_id, 1));

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use api::region::RegionResponse;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashSet;
use std::sync::Arc;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;

View File

@@ -172,7 +172,7 @@ async fn test_on_datanode_drop_regions() {
let result = rx.try_recv().unwrap();
results.push(result);
}
results.sort_unstable_by(|(a, _), (b, _)| a.id.cmp(&b.id));
results.sort_unstable_by_key(|(a, _)| a.id);
let (peer, request) = results.remove(0);
check(peer, request, 1, RegionId::new(table_id, 1), false);

View File

@@ -390,7 +390,7 @@ impl std::fmt::Debug for FlowMetadataManager {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::BTreeMap;
use std::sync::Arc;

View File

@@ -237,7 +237,7 @@ impl TopicNameManager {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use super::*;

View File

@@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
#![feature(duration_millis_float)]
pub mod cache;

View File

@@ -187,7 +187,7 @@ impl<T> PaginationStream<T> {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::BTreeMap;
use std::sync::Arc;

View File

@@ -84,7 +84,7 @@ impl State for UpdateTableInfos {
.persistent_ctx
.update_table_infos
.iter()
.zip(table_info_values.into_iter())
.zip(table_info_values)
{
let new_table_info = Self::build_new_table_info(
*table_id,

View File

@@ -949,7 +949,7 @@ impl Display for ReconcileTableMetrics {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;

View File

@@ -337,7 +337,7 @@ impl Inner {
#[cfg(test)]
mod tests {
use std::any::Any;
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashSet;
use std::sync::Arc;

View File

@@ -355,7 +355,7 @@ impl MetadataSnapshotManager {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use common_test_util::temp_dir::{TempDir, create_temp_dir};

View File

@@ -380,7 +380,7 @@ impl PoisonStore for KvStateStore {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::env;
use std::sync::Arc;

View File

@@ -172,7 +172,7 @@ pub fn extract_topic_from_wal_options(
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use common_wal::config::kafka::MetasrvKafkaConfig;
use common_wal::config::kafka::common::KafkaTopicConfig;

View File

@@ -136,7 +136,7 @@ impl KafkaTopicPool {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use common_wal::maybe_skip_kafka_integration_test;
use common_wal::test_util::get_kafka_endpoints;

View File

@@ -14,7 +14,6 @@
//! Common traits and structures for the procedure framework.
#![feature(assert_matches)]
pub mod error;
pub mod event;

View File

@@ -920,7 +920,7 @@ pub(crate) mod test_util {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use common_error::mock::MockError;
use common_error::status_code::StatusCode;

View File

@@ -704,7 +704,7 @@ impl Runner {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use std::sync::atomic::{AtomicU64, Ordering};

View File

@@ -57,7 +57,7 @@ fn merge_multiple_values(
let (key, value) = pairs.into_iter().next().unwrap();
let prefix = KeySet::with_prefix(&key);
let mut parsed_segments = parse_segments(segments, &prefix)?;
parsed_segments.sort_unstable_by(|a, b| a.0.cmp(&b.0));
parsed_segments.sort_unstable_by_key(|a| a.0);
// Safety: `parsed_segments` must larger than 0.
let segment_num = parsed_segments.last().unwrap().0;
@@ -133,7 +133,7 @@ pub fn multiple_value_stream(
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use futures::TryStreamExt;
use futures::stream::{self};

View File

@@ -701,19 +701,11 @@ impl QueryMemoryTracker {
"{} requested, {} used globally ({}%), {} used by this stream (privileged: {}), effective limit: {} ({}%), hard limit: {}",
ReadableSize(additional as u64),
ReadableSize(current as u64),
if self.limit > 0 {
current * 100 / self.limit
} else {
0
},
(current * 100).checked_div(self.limit).unwrap_or(0),
ReadableSize(stream_tracked as u64),
is_privileged,
ReadableSize(effective_limit as u64),
if self.limit > 0 {
effective_limit * 100 / self.limit
} else {
0
},
(effective_limit * 100).checked_div(self.limit).unwrap_or(0),
ReadableSize(self.limit as u64)
);
error::ExceedMemoryLimitSnafu { msg }.fail()

View File

@@ -437,7 +437,7 @@ fn maybe_align_json_array_with_schema(
}
let mut aligned = Vec::with_capacity(arrays.len());
for (field, array) in schema.fields().iter().zip(arrays.into_iter()) {
for (field, array) in schema.fields().iter().zip(arrays) {
if !is_json_extension_type(field) {
aligned.push(array);
continue;

View File

@@ -122,7 +122,7 @@ pub fn parse_column_default_constraint(
#[cfg(test)]
mod test {
use std::assert_matches::assert_matches;
use std::assert_matches;
use datatypes::prelude::{ConcreteDataType, Value};
use datatypes::types::BooleanType;

View File

@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
pub mod convert;
pub mod default_constraint;
pub mod error;

View File

@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
use std::net::SocketAddr;
use error::{EndpointIPV4NotFoundSnafu, ResolveEndpointSnafu, Result};
@@ -59,7 +57,7 @@ async fn resolve_to_ipv4_one<T: AsRef<str>>(endpoint: T) -> Result<String> {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use common_telemetry::warn;
use rskafka::client::{Credentials, SaslConfig};

View File

@@ -552,14 +552,15 @@ impl DatanodeBuilder {
if kafka_config.create_index && opts.node_id.is_none() {
warn!("The WAL index creation only available in distributed mode.")
}
let global_index_collector = if kafka_config.create_index && opts.node_id.is_some()
let global_index_collector = if kafka_config.create_index
&& let Some(node_id) = opts.node_id
{
let operator = new_object_store_without_cache(
&opts.storage.store,
&opts.storage.data_home,
)
.await?;
let path = default_index_file(opts.node_id.unwrap());
let path = default_index_file(node_id);
Some(Self::build_global_index_collector(
kafka_config.dump_index_interval,
operator,
@@ -785,7 +786,7 @@ async fn open_all_regions(
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::{BTreeMap, HashMap};
use std::sync::Arc;

View File

@@ -295,7 +295,7 @@ impl HeartbeatResponseHandler for RegionHeartbeatResponseHandler {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;

View File

@@ -47,7 +47,7 @@ impl InstructionHandler for CloseRegionsHandler {
let results = join_all(futs).await;
let mut errors = vec![];
for (region_id, result) in region_ids.into_iter().zip(results.into_iter()) {
for (region_id, result) in region_ids.into_iter().zip(results) {
match result {
Ok(_) => (),
Err(error::Error::RegionNotFound { .. }) => {
@@ -79,7 +79,6 @@ mod tests {
use std::assert_matches;
use std::sync::Arc;
use assert_matches::assert_matches;
use common_meta::RegionIdent;
use common_meta::heartbeat::handler::{HandleControl, HeartbeatResponseHandler};
use common_meta::heartbeat::mailbox::MessageMeta;

View File

@@ -225,7 +225,7 @@ impl HandlerContext {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use std::time::Duration;

View File

@@ -72,7 +72,7 @@ impl InstructionHandler for OpenRegionsHandler {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;

View File

@@ -184,7 +184,7 @@ impl UpgradeRegionsHandler {
{
Ok(responses) => {
replies.extend(
Self::convert_responses_to_replies(responses, &catchup_regions).into_iter(),
Self::convert_responses_to_replies(responses, &catchup_regions),
);
}
Err(_) => {

View File

@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
pub mod alive_keeper;
pub mod config;
pub mod datanode;

View File

@@ -1667,7 +1667,7 @@ impl RegionAttribute {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use api::v1::SemanticType;
use common_error::ext::ErrorExt;

View File

@@ -426,7 +426,7 @@ fn decode_struct_with_context<'a>(
let (items, fields) = struct_value.into_parts();
for (field, field_value) in fields.fields().iter().zip(items.into_iter()) {
for (field, field_value) in fields.fields().iter().zip(items) {
let field_context = context.with_key(field.name());
let json_value = decode_value_with_context(field_value, &field_context)?;
json_object.insert(field.name().to_string(), json_value);
@@ -561,7 +561,7 @@ fn decode_struct_with_settings<'a>(
// Process each field in the struct value
let (struct_data, fields) = struct_value.into_parts();
for (field, value) in fields.fields().iter().zip(struct_data.into_iter()) {
for (field, value) in fields.fields().iter().zip(struct_data) {
let field_context = context.with_key(field.name());
// Check if this field should be treated as unstructured

View File

@@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
#![feature(box_patterns)]
pub mod arrow_array;
pub mod data_type;
pub mod duration;

View File

@@ -773,7 +773,7 @@ mod tests {
r#"Failed to merge JSON datatype: datatypes have conflict, this: {"hello":"<String>","list":["<Number>"],"object":{"a":"<Number>"}}, that: "<Number>""#,
r#"Failed to merge JSON datatype: datatypes have conflict, this: {"hello":"<String>","list":["<Number>"],"object":{"a":"<Number>"}}, that: ["<Number>"]"#,
];
for (json, expect) in jsons.into_iter().zip(expects.into_iter()) {
for (json, expect) in jsons.into_iter().zip(expects) {
test(json, json_type, Err(expect))?;
}

View File

@@ -922,7 +922,7 @@ impl TryFrom<Value> for serde_json::Value {
let map = struct_type
.fields()
.iter()
.zip(items.into_iter())
.zip(items)
.map(|(field, value)| {
Ok((
field.name().to_string(),
@@ -2723,26 +2723,26 @@ pub(crate) mod tests {
.unwrap()
);
assert_eq!(
ScalarValue::UInt8(Some(u8::MIN + 1)),
Value::UInt8(u8::MIN + 1)
ScalarValue::UInt8(Some(1)),
Value::UInt8(1)
.try_to_scalar_value(&ConcreteDataType::uint8_datatype())
.unwrap()
);
assert_eq!(
ScalarValue::UInt16(Some(u16::MIN + 2)),
Value::UInt16(u16::MIN + 2)
ScalarValue::UInt16(Some(2)),
Value::UInt16(2)
.try_to_scalar_value(&ConcreteDataType::uint16_datatype())
.unwrap()
);
assert_eq!(
ScalarValue::UInt32(Some(u32::MIN + 3)),
Value::UInt32(u32::MIN + 3)
ScalarValue::UInt32(Some(3)),
Value::UInt32(3)
.try_to_scalar_value(&ConcreteDataType::uint32_datatype())
.unwrap()
);
assert_eq!(
ScalarValue::UInt64(Some(u64::MIN + 4)),
Value::UInt64(u64::MIN + 4)
ScalarValue::UInt64(Some(4)),
Value::UInt64(4)
.try_to_scalar_value(&ConcreteDataType::uint64_datatype())
.unwrap()
);

View File

@@ -458,7 +458,7 @@ impl BinaryVector {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use arrow::datatypes::DataType as ArrowDataType;
use common_base::bytes::Bytes;

View File

@@ -328,7 +328,7 @@ mod tests {
),
];
let mut builder = JsonVectorBuilder::new(JsonNativeType::Null, 1);
for (json, result) in jsons.into_iter().zip(results.into_iter()) {
for (json, result) in jsons.into_iter().zip(results) {
push(json, &mut builder, result);
}
let vector = builder.to_vector();
@@ -448,7 +448,7 @@ mod tests {
for (builder, (expect_type, expect_vector)) in builder
.builders
.iter()
.zip(expect_types.into_iter().zip(expect_vectors.into_iter()))
.zip(expect_types.into_iter().zip(expect_vectors))
{
assert_eq!(builder.json_type.name(), expect_type);
let vector = builder.inner.to_vector_cloned();

View File

@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
pub mod config;
pub mod engine;
pub mod error;

View File

@@ -105,7 +105,7 @@ impl FileRegion {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use store_api::region_request::PathType;

View File

@@ -1060,7 +1060,7 @@ impl StreamingEngine {
let fetch_order: Vec<FetchFromRow> = table_col_names
.iter()
.zip(default_vals.into_iter())
.zip(default_vals)
.map(|(col_name, col_default_val)| {
name_to_col
.get(col_name)

View File

@@ -17,7 +17,6 @@
//! It also contains definition of expression, adapter and plan, and internal state management.
#![allow(dead_code)]
#![warn(clippy::missing_docs_in_private_items)]
#![warn(clippy::too_many_lines)]
// TODO(discord9): enable this lint to handle out of bound access

View File

@@ -213,7 +213,7 @@ impl KeyExpiryManager {
let mut before = self.event_ts_to_key.split_off(&expire_time);
std::mem::swap(&mut before, &mut self.event_ts_to_key);
Some(before.into_iter().flat_map(|(_ts, keys)| keys.into_iter()))
Some(before.into_values().flat_map(|keys| keys.into_iter()))
}
}
@@ -408,9 +408,7 @@ impl Arrangement {
pub fn get_next_update_time(&self, now: &Timestamp) -> Option<Timestamp> {
// iter over batches that only have updates of `timestamp>now` and find the first non empty batch, then get the minimum timestamp in that batch
for (_ts, batch) in self.spine.range((Bound::Excluded(now), Bound::Unbounded)) {
let min_ts = batch
.iter()
.flat_map(|(_k, v)| v.iter().map(|(_, ts, _)| *ts).min())
let min_ts = batch.values().flat_map(|v| v.iter().map(|(_, ts, _)| *ts).min())
.min();
if min_ts.is_some() {

View File

@@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
pub mod error;
pub mod events;
pub mod frontend;

View File

@@ -173,7 +173,7 @@ impl<R: RangeReader> InvertedIndexFooterReader<R> {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use prost::Message;

View File

@@ -13,7 +13,6 @@
// limitations under the License.
#![feature(iter_partition_in_place)]
#![feature(assert_matches)]
pub mod bitmap;
pub mod bloom_filter;

View File

@@ -199,57 +199,53 @@ impl TimeFilter {
let mut start_dt = None;
let mut end_dt = None;
if self.start.is_some() && self.end.is_none() && self.span.is_none() {
// Only 'start' is provided
let s = self.start.as_ref().unwrap();
let (start, end_opt) = Self::parse_datetime(s)?;
if end_opt.is_none() {
match (&self.start, &self.end, &self.span) {
(Some(start), None, None) => {
let (start, end_opt) = Self::parse_datetime(start)?;
if end_opt.is_none() {
return Err(InvalidTimeFilterSnafu {
filter: self.clone(),
}
.build());
}
start_dt = Some(start);
end_dt = end_opt;
}
(Some(start), Some(end), _) => {
// Both 'start' and 'end' are provided
let (start, _) = Self::parse_datetime(start)?;
let (end, _) = Self::parse_datetime(end)?;
start_dt = Some(start);
end_dt = Some(end);
}
(Some(start), None, Some(span)) => {
let (start, _) = Self::parse_datetime(start)?;
let span = Self::parse_span(span)?;
let end = start + span;
start_dt = Some(start);
end_dt = Some(end);
}
(None, Some(end), Some(span)) => {
let (end, _) = Self::parse_datetime(end)?;
let span = Self::parse_span(span)?;
let start = end - span;
start_dt = Some(start);
end_dt = Some(end);
}
(None, None, Some(span)) => {
let span = Self::parse_span(span)?;
let end = Utc::now();
let start = end - span;
start_dt = Some(start);
end_dt = Some(end);
}
_ => {
// Exception
return Err(InvalidTimeFilterSnafu {
filter: self.clone(),
}
.build());
}
start_dt = Some(start);
end_dt = end_opt;
} else if self.start.is_some() && self.end.is_some() {
// Both 'start' and 'end' are provided
let (start, _) = Self::parse_datetime(self.start.as_ref().unwrap())?;
let (end, _) = Self::parse_datetime(self.end.as_ref().unwrap())?;
start_dt = Some(start);
end_dt = Some(end);
} else if self.span.is_some() && (self.start.is_some() || self.end.is_some()) {
// 'span' with 'start' or 'end'
let span = Self::parse_span(self.span.as_ref().unwrap())?;
if self.start.is_some() {
let (start, _) = Self::parse_datetime(self.start.as_ref().unwrap())?;
let end = start + span;
start_dt = Some(start);
end_dt = Some(end);
} else {
let (end, _) = Self::parse_datetime(self.end.as_ref().unwrap())?;
let start = end - span;
start_dt = Some(start);
end_dt = Some(end);
}
} else if self.span.is_some() && self.start.is_none() && self.end.is_none() {
// Only 'span' is provided
let span = Self::parse_span(self.span.as_ref().unwrap())?;
let end = Utc::now();
let start = end - span;
start_dt = Some(start);
end_dt = Some(end);
} else if self.start.is_some() && self.span.is_some() && self.end.is_some() {
// All fields are provided; 'start' and 'end' take priority
let (start, _) = Self::parse_datetime(self.start.as_ref().unwrap())?;
let (end, _) = Self::parse_datetime(self.end.as_ref().unwrap())?;
start_dt = Some(start);
end_dt = Some(end);
} else {
// Exception
return Err(InvalidTimeFilterSnafu {
filter: self.clone(),
}
.build());
}
// Validate that end is after start

View File

@@ -62,9 +62,7 @@ impl RegionWalRange {
fn next_batch_size(&self) -> Option<u64> {
if self.current_entry_id < self.end_entry_id {
Some(
self.end_entry_id
.checked_sub(self.current_entry_id)
.unwrap_or_default(),
self.end_entry_id.saturating_sub(self.current_entry_id),
)
} else {
None

View File

@@ -550,7 +550,7 @@ fn check_termination(offset: i64, end_offset: i64) -> bool {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Duration;

View File

@@ -306,7 +306,7 @@ pub(crate) fn maybe_emit_entry(
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use super::*;

View File

@@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(io_error_more)]
#![feature(assert_matches)]
pub mod error;
pub mod kafka;
pub mod metrics;

View File

@@ -212,8 +212,8 @@ impl Inner {
}
}
}
} else if let Err(err) = leader_provider.ask_leader().await {
return Err(err);
} else {
leader_provider.ask_leader().await?;
}
}

View File

@@ -208,8 +208,8 @@ impl Inner {
}
}
}
} else if let Err(err) = leader_provider.ask_leader().await {
return Err(err);
} else {
leader_provider.ask_leader().await?;
}
}

View File

@@ -984,7 +984,7 @@ impl MySqlElection {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::env;
use common_meta::maybe_skip_mysql_integration_test;

View File

@@ -828,7 +828,7 @@ impl PgElection {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::env;
use common_meta::maybe_skip_postgres_integration_test;

View File

@@ -109,7 +109,7 @@ impl GcScheduler {
}
// Sort candidates by score in descending order and take top N
candidates.sort_by(|a, b| b.score.cmp(&a.score));
candidates.sort_by_key(|a| a.score);
let top_candidates: Vec<GcCandidate> = candidates
.into_iter()
.take(self.config.regions_per_table_threshold)

View File

@@ -346,7 +346,7 @@ impl GcScheduler {
// Add to need_retry_regions since it failed
combined_report
.need_retry_regions
.extend(fast_list_regions.clone().into_iter());
.extend(fast_list_regions.clone());
}
}
}

View File

@@ -870,7 +870,7 @@ impl HeartbeatHandlerGroupBuilderCustomizer for DefaultHeartbeatHandlerGroupBuil
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use std::time::Duration;
@@ -972,7 +972,7 @@ mod tests {
"RemapFlowPeerHandler",
];
assert_eq!(names.len(), handlers.len());
for (handler, name) in handlers.iter().zip(names.into_iter()) {
for (handler, name) in handlers.iter().zip(names) {
assert_eq!(handler.name, name);
}
}
@@ -1009,7 +1009,7 @@ mod tests {
"RemapFlowPeerHandler",
];
assert_eq!(names.len(), handlers.len());
for (handler, name) in handlers.iter().zip(names.into_iter()) {
for (handler, name) in handlers.iter().zip(names) {
assert_eq!(handler.name, name);
}
}
@@ -1043,7 +1043,7 @@ mod tests {
"RemapFlowPeerHandler",
];
assert_eq!(names.len(), handlers.len());
for (handler, name) in handlers.iter().zip(names.into_iter()) {
for (handler, name) in handlers.iter().zip(names) {
assert_eq!(handler.name, name);
}
}
@@ -1077,7 +1077,7 @@ mod tests {
"RemapFlowPeerHandler",
];
assert_eq!(names.len(), handlers.len());
for (handler, name) in handlers.iter().zip(names.into_iter()) {
for (handler, name) in handlers.iter().zip(names) {
assert_eq!(handler.name, name);
}
}
@@ -1111,7 +1111,7 @@ mod tests {
"RemapFlowPeerHandler",
];
assert_eq!(names.len(), handlers.len());
for (handler, name) in handlers.iter().zip(names.into_iter()) {
for (handler, name) in handlers.iter().zip(names) {
assert_eq!(handler.name, name);
}
}
@@ -1145,7 +1145,7 @@ mod tests {
];
assert_eq!(names.len(), handlers.len());
for (handler, name) in handlers.iter().zip(names.into_iter()) {
for (handler, name) in handlers.iter().zip(names) {
assert_eq!(handler.name, name);
}
}
@@ -1179,7 +1179,7 @@ mod tests {
];
assert_eq!(names.len(), handlers.len());
for (handler, name) in handlers.iter().zip(names.into_iter()) {
for (handler, name) in handlers.iter().zip(names) {
assert_eq!(handler.name, name);
}
}
@@ -1212,7 +1212,7 @@ mod tests {
"RemapFlowPeerHandler",
];
assert_eq!(names.len(), handlers.len());
for (handler, name) in handlers.iter().zip(names.into_iter()) {
for (handler, name) in handlers.iter().zip(names) {
assert_eq!(handler.name, name);
}
}

View File

@@ -12,10 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#![feature(assert_matches)]
#![feature(hash_set_entry)]
#![feature(duration_constructors)]
#![feature(string_from_utf8_lossy_owned)]
pub mod bootstrap;
pub mod cache_invalidator;

View File

@@ -924,7 +924,7 @@ impl Procedure for RegionMigrationProcedure {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::sync::Arc;
use common_meta::distributed_time_constants::default_distributed_time_constants;

View File

@@ -372,7 +372,7 @@ impl DowngradeLeaderRegion {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use common_meta::key::table_route::TableRouteValue;

View File

@@ -93,7 +93,7 @@ impl PreFlushRegion {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use store_api::storage::RegionId;

View File

@@ -620,7 +620,7 @@ impl RegionMigrationManager {
#[cfg(test)]
mod test {
use std::assert_matches::assert_matches;
use std::assert_matches;
use common_meta::key::table_route::LogicalTableRouteValue;
use common_meta::key::test_utils::new_test_table_info;

View File

@@ -187,7 +187,7 @@ impl RegionMigrationStart {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use common_meta::key::test_utils::new_test_table_info;
use common_meta::peer::Peer;

View File

@@ -208,7 +208,7 @@ impl OpenCandidateRegion {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use common_catalog::consts::MITO2_ENGINE;

View File

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};

View File

@@ -88,7 +88,7 @@ impl UpdateMetadata {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;

View File

@@ -72,7 +72,7 @@ impl UpdateMetadata {
#[cfg(test)]
mod tests {
use std::assert_matches::assert_matches;
use std::assert_matches;
use std::collections::HashMap;
use std::sync::Arc;

Some files were not shown because too many files have changed in this diff Show More