mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
Update Rust Edition to 2024 (#7766)
* #7749 Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
@@ -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)]
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user