Update Rust Edition to 2024 (#7766)

* #7749

Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
chonghe
2025-08-13 11:04:31 +08:00
committed by GitHub
parent bd6b8b6a65
commit 522bd9e9c6
468 changed files with 3594 additions and 3396 deletions

View File

@@ -173,11 +173,7 @@ fn mallinfo() -> libc::mallinfo2 {
}
fn into_result(result: c_int) -> Result<(), c_int> {
if result == 1 {
Ok(())
} else {
Err(result)
}
if result == 1 { Ok(()) } else { Err(result) }
}
#[cfg(test)]

View File

@@ -8,10 +8,10 @@
//! A) `JEMALLOC_SYS_WITH_MALLOC_CONF` at compile-time.
//! B) `_RJEM_MALLOC_CONF` at runtime.
use metrics::{
set_gauge, set_gauge_vec, try_create_int_gauge, try_create_int_gauge_vec, IntGauge, IntGaugeVec,
IntGauge, IntGaugeVec, set_gauge, set_gauge_vec, try_create_int_gauge, try_create_int_gauge_vec,
};
use std::sync::LazyLock;
use tikv_jemalloc_ctl::{arenas, epoch, raw, stats, Access, AsName, Error};
use tikv_jemalloc_ctl::{Access, AsName, Error, arenas, epoch, raw, stats};
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
@@ -114,8 +114,10 @@ pub fn scrape_jemalloc_metrics_fallible() -> Result<(), Error> {
}
unsafe fn set_stats_gauge(metric: &metrics::Result<IntGaugeVec>, arena: u32, stat: &str) {
if let Ok(val) = raw::read::<usize>(stat.as_bytes()) {
set_gauge_vec(metric, &[&format!("arena_{arena}")], val as i64);
unsafe {
if let Ok(val) = raw::read::<usize>(stat.as_bytes()) {
set_gauge_vec(metric, &[&format!("arena_{arena}")], val as i64);
}
}
}