From 473bf0389a078e09351db3ef662343bd5cf56db4 Mon Sep 17 00:00:00 2001 From: auronandace Date: Fri, 6 Feb 2026 14:53:59 +0000 Subject: [PATCH] start adding some clippy lints to Cargo.toml --- Cargo.toml | 6 ++++++ src/header/pthread/tls.rs | 2 +- src/ld_so/debug.rs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d1dd58b8c6..f9bb596025 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,12 @@ members = [ ] exclude = ["tests", "dlmalloc-rs"] +[workspace.lints.clippy] +ptr_cast_constness = "warn" + +[lints.clippy] +ptr_cast_constness = "warn" + [build-dependencies] cc = "1" diff --git a/src/header/pthread/tls.rs b/src/header/pthread/tls.rs index b4805834c0..83f2826c46 100644 --- a/src/header/pthread/tls.rs +++ b/src/header/pthread/tls.rs @@ -59,7 +59,7 @@ pub unsafe extern "C" fn pthread_setspecific(key: pthread_key_t, value: *const c }); //println!("Valid key for pthread_setspecific key {:#0x} value {:p} (was {:p})", key, value, record.data); - record.data = value as *mut c_void; + record.data = value.cast_mut(); 0 } diff --git a/src/ld_so/debug.rs b/src/ld_so/debug.rs index 0a39198b15..02b6530063 100644 --- a/src/ld_so/debug.rs +++ b/src/ld_so/debug.rs @@ -108,7 +108,7 @@ impl LinkMap { (*map).l_addr = l_addr; (*map).l_ld = l_ld; let c_name = CString::new(name).unwrap(); - (*map).l_name = c_name.into_raw() as *const c_char; + (*map).l_name = c_name.into_raw().cast_const(); } map }