mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2026-05-20 06:50:37 +00:00
chore: update toolchain to 2024-12-25 (#5430)
* chore: update toolchain to 2024-12-25 * chore: fix clippy * feat: update flakes * chore: remove `rerun-if-changed` for now * chore: update shadow-rs * fix: clippy * chore: update version in DEV_BUILDER_IMAGE_TAG --------- Co-authored-by: Ning Sun <sunning@greptime.com>
This commit is contained in:
@@ -100,7 +100,7 @@ pub fn options_from_column_schema(column_schema: &ColumnSchema) -> Option<Column
|
||||
pub fn contains_fulltext(options: &Option<ColumnOptions>) -> bool {
|
||||
options
|
||||
.as_ref()
|
||||
.map_or(false, |o| o.options.contains_key(FULLTEXT_GRPC_KEY))
|
||||
.is_some_and(|o| o.options.contains_key(FULLTEXT_GRPC_KEY))
|
||||
}
|
||||
|
||||
/// Tries to construct a `ColumnOptions` from the given `FulltextOptions`.
|
||||
|
||||
@@ -303,7 +303,7 @@ impl KvBackend for CachedKvBackend {
|
||||
.lock()
|
||||
.unwrap()
|
||||
.as_ref()
|
||||
.map_or(false, |v| !self.validate_version(*v))
|
||||
.is_some_and(|v| !self.validate_version(*v))
|
||||
{
|
||||
self.cache.invalidate(key).await;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ struct Test<'a, T: FileOpener> {
|
||||
expected: Vec<&'a str>,
|
||||
}
|
||||
|
||||
impl<'a, T: FileOpener> Test<'a, T> {
|
||||
impl<T: FileOpener> Test<'_, T> {
|
||||
pub async fn run(self) {
|
||||
let result = FileStream::new(
|
||||
&self.config,
|
||||
|
||||
@@ -164,7 +164,7 @@ impl FromStr for Decimal128 {
|
||||
type Err = Error;
|
||||
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let len = s.as_bytes().len();
|
||||
let len = s.len();
|
||||
if len <= BYTES_TO_OVERFLOW_RUST_DECIMAL {
|
||||
let rd = RustDecimal::from_str_exact(s).context(ParseRustDecimalStrSnafu { raw: s })?;
|
||||
Ok(Self::from(rd))
|
||||
|
||||
@@ -78,7 +78,7 @@ impl DropTableProcedure {
|
||||
})
|
||||
}
|
||||
|
||||
pub(crate) async fn on_prepare<'a>(&mut self) -> Result<Status> {
|
||||
pub(crate) async fn on_prepare(&mut self) -> Result<Status> {
|
||||
if self.executor.on_prepare(&self.context).await?.stop() {
|
||||
return Ok(Status::done());
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ impl TxnOpGetResponseSet {
|
||||
impl From<&mut Vec<TxnOpResponse>> for TxnOpGetResponseSet {
|
||||
fn from(value: &mut Vec<TxnOpResponse>) -> Self {
|
||||
let value = value
|
||||
.extract_if(|resp| matches!(resp, TxnOpResponse::ResponseGet(_)))
|
||||
.extract_if(.., |resp| matches!(resp, TxnOpResponse::ResponseGet(_)))
|
||||
.flat_map(|resp| {
|
||||
// Safety: checked
|
||||
let TxnOpResponse::ResponseGet(r) = resp else {
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
#![feature(assert_matches)]
|
||||
#![feature(btree_extract_if)]
|
||||
#![feature(async_closure)]
|
||||
#![feature(let_chains)]
|
||||
#![feature(extract_if)]
|
||||
#![feature(hash_extract_if)]
|
||||
|
||||
@@ -92,10 +92,7 @@ pub fn rename_logical_plan_columns(
|
||||
};
|
||||
|
||||
let (qualifier_rename, field_rename) =
|
||||
match plan.schema().qualified_field_from_column(&old_column) {
|
||||
Ok(qualifier_and_field) => qualifier_and_field,
|
||||
Err(err) => return Err(err),
|
||||
};
|
||||
plan.schema().qualified_field_from_column(&old_column)?;
|
||||
|
||||
for (qualifier, field) in plan.schema().iter() {
|
||||
if qualifier.eq(&qualifier_rename) && field.as_ref() == field_rename {
|
||||
|
||||
@@ -16,14 +16,9 @@ use std::collections::BTreeSet;
|
||||
use std::env;
|
||||
|
||||
use build_data::{format_timestamp, get_source_time};
|
||||
use shadow_rs::{CARGO_METADATA, CARGO_TREE};
|
||||
use shadow_rs::{BuildPattern, ShadowBuilder, CARGO_METADATA, CARGO_TREE};
|
||||
|
||||
fn main() -> shadow_rs::SdResult<()> {
|
||||
println!(
|
||||
"cargo:rerun-if-changed={}/.git/refs/heads",
|
||||
env!("CARGO_RUSTC_CURRENT_DIR")
|
||||
);
|
||||
|
||||
println!(
|
||||
"cargo:rustc-env=SOURCE_TIMESTAMP={}",
|
||||
if let Ok(t) = get_source_time() {
|
||||
@@ -39,10 +34,14 @@ fn main() -> shadow_rs::SdResult<()> {
|
||||
// made as a submodule in another repo.
|
||||
let src_path = env::var("CARGO_WORKSPACE_DIR").or_else(|_| env::var("CARGO_MANIFEST_DIR"))?;
|
||||
let out_path = env::var("OUT_DIR")?;
|
||||
let _ = shadow_rs::Shadow::build_with(
|
||||
src_path,
|
||||
out_path,
|
||||
BTreeSet::from([CARGO_METADATA, CARGO_TREE]),
|
||||
)?;
|
||||
|
||||
let _ = ShadowBuilder::builder()
|
||||
.build_pattern(BuildPattern::Lazy)
|
||||
.src_path(src_path)
|
||||
.out_path(out_path)
|
||||
.deny_const(BTreeSet::from([CARGO_METADATA, CARGO_TREE]))
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ pub fn parse_string_to_vector_type_value(s: &str, dim: Option<u32>) -> Result<Ve
|
||||
let content = trimmed[1..trimmed.len() - 1].trim();
|
||||
|
||||
if content.is_empty() {
|
||||
if dim.map_or(false, |d| d != 0) {
|
||||
if dim.is_some_and(|d| d != 0) {
|
||||
return InvalidVectorSnafu {
|
||||
msg: format!("Failed to parse {s} to Vector value: wrong dimension"),
|
||||
}
|
||||
@@ -139,7 +139,7 @@ pub fn parse_string_to_vector_type_value(s: &str, dim: Option<u32>) -> Result<Ve
|
||||
.collect::<Result<Vec<f32>>>()?;
|
||||
|
||||
// Check dimension
|
||||
if dim.map_or(false, |d| d as usize != elements.len()) {
|
||||
if dim.is_some_and(|d| d as usize != elements.len()) {
|
||||
return InvalidVectorSnafu {
|
||||
msg: format!("Failed to parse {s} to Vector value: wrong dimension"),
|
||||
}
|
||||
|
||||
@@ -320,8 +320,7 @@ impl VectorDiff {
|
||||
|
||||
fn try_new(vector: VectorRef, diff: Option<VectorRef>) -> Result<Self, EvalError> {
|
||||
ensure!(
|
||||
diff.as_ref()
|
||||
.map_or(true, |diff| diff.len() == vector.len()),
|
||||
diff.as_ref().is_none_or(|diff| diff.len() == vector.len()),
|
||||
InvalidArgumentSnafu {
|
||||
reason: "Length of vector and diff should be the same"
|
||||
}
|
||||
|
||||
@@ -897,9 +897,6 @@ pub(crate) fn match_for_io_error(err_status: &tonic::Status) -> Option<&std::io:
|
||||
}
|
||||
}
|
||||
|
||||
err = match err.source() {
|
||||
Some(err) => err,
|
||||
None => return None,
|
||||
};
|
||||
err = err.source()?;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#![feature(async_closure)]
|
||||
#![feature(result_flattening)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(extract_if)]
|
||||
|
||||
@@ -67,7 +67,7 @@ impl UpdateMetadata {
|
||||
// Removes the candidate region in followers.
|
||||
let removed = region_route
|
||||
.follower_peers
|
||||
.extract_if(|peer| peer.id == candidate.id)
|
||||
.extract_if(.., |peer| peer.id == candidate.id)
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
if removed.len() > 1 {
|
||||
|
||||
@@ -358,7 +358,7 @@ impl RegionSupervisor {
|
||||
}
|
||||
|
||||
let migrating_regions = regions
|
||||
.extract_if(|(_, _, region_id)| {
|
||||
.extract_if(.., |(_, _, region_id)| {
|
||||
self.region_migration_manager.tracker().contains(*region_id)
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
@@ -80,7 +80,7 @@ impl heartbeat_server::Heartbeat for Metasrv {
|
||||
.await
|
||||
.map_err(|e| e.into());
|
||||
|
||||
is_not_leader = res.as_ref().map_or(false, |r| r.is_not_leader());
|
||||
is_not_leader = res.as_ref().is_ok_and(|r| r.is_not_leader());
|
||||
|
||||
debug!("Sending heartbeat response: {:?}", res);
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ struct CompactionSstReaderBuilder<'a> {
|
||||
merge_mode: MergeMode,
|
||||
}
|
||||
|
||||
impl<'a> CompactionSstReaderBuilder<'a> {
|
||||
impl CompactionSstReaderBuilder<'_> {
|
||||
/// Builds [BoxedBatchReader] that reads all SST files and yields batches in primary key order.
|
||||
async fn build_sst_reader(self) -> Result<BoxedBatchReader> {
|
||||
let mut scan_input = ScanInput::new(self.sst_layer, ProjectionMapper::all(&self.metadata)?)
|
||||
|
||||
@@ -182,7 +182,7 @@ pub(crate) struct IndexerBuilder<'a> {
|
||||
pub(crate) bloom_filter_index_config: BloomFilterConfig,
|
||||
}
|
||||
|
||||
impl<'a> IndexerBuilder<'a> {
|
||||
impl IndexerBuilder<'_> {
|
||||
/// Sanity check for arguments and create a new [Indexer] if arguments are valid.
|
||||
pub(crate) async fn build(self) -> Indexer {
|
||||
let mut indexer = Indexer {
|
||||
|
||||
@@ -781,7 +781,7 @@ impl JsonLike for Value {
|
||||
if left.len() != right.len() {
|
||||
false
|
||||
} else {
|
||||
left.iter().zip(right).map(|(a, b)| a.eq(&b)).all(|a| a)
|
||||
left.iter().zip(right).all(|(a, b)| a.eq(&b))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ pub struct PuffinMetadataCache {
|
||||
cache: moka::sync::Cache<String, Arc<FileMetadata>>,
|
||||
}
|
||||
|
||||
fn puffin_metadata_weight(k: &String, v: &Arc<FileMetadata>) -> u32 {
|
||||
(k.as_bytes().len() + v.memory_usage()) as u32
|
||||
fn puffin_metadata_weight(k: &str, v: &Arc<FileMetadata>) -> u32 {
|
||||
(k.len() + v.memory_usage()) as u32
|
||||
}
|
||||
|
||||
impl PuffinMetadataCache {
|
||||
@@ -37,7 +37,7 @@ impl PuffinMetadataCache {
|
||||
Self {
|
||||
cache: moka::sync::CacheBuilder::new(capacity)
|
||||
.name("puffin_metadata")
|
||||
.weigher(puffin_metadata_weight)
|
||||
.weigher(|k: &String, v| puffin_metadata_weight(k, v))
|
||||
.eviction_listener(|k, v, _cause| {
|
||||
let size = puffin_metadata_weight(&k, &v);
|
||||
cache_bytes
|
||||
|
||||
@@ -244,11 +244,11 @@ impl MysqlInstanceShim {
|
||||
Ok((params, columns))
|
||||
}
|
||||
|
||||
async fn do_execute<'a>(
|
||||
async fn do_execute(
|
||||
&mut self,
|
||||
query_ctx: QueryContextRef,
|
||||
stmt_key: String,
|
||||
params: Params<'a>,
|
||||
params: Params<'_>,
|
||||
) -> Result<Vec<std::result::Result<Output, error::Error>>> {
|
||||
let sql_plan = match self.plan(&stmt_key) {
|
||||
None => {
|
||||
|
||||
@@ -122,7 +122,7 @@ impl PartialEq for OptionMap {
|
||||
other
|
||||
.secrets
|
||||
.get(key)
|
||||
.map_or(false, |v| value.expose_secret() == v.expose_secret())
|
||||
.is_some_and(|v| value.expose_secret() == v.expose_secret())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user