tidy up lints and add zero_ptr

This commit is contained in:
auronandace
2026-02-07 14:58:02 +00:00
parent 12dc6766de
commit 4a84b2f04c
4 changed files with 19 additions and 16 deletions
+16
View File
@@ -20,14 +20,30 @@ members = [
exclude = ["tests", "dlmalloc-rs"]
[workspace.lints.clippy]
cast_lossless = "warn"
cast_ptr_alignment = "allow" # TODO change to warn or deny when ready to fix
mut_from_ref = "allow"
ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
ref_as_ptr = "warn"
zero_ptr = "warn"
[lints.clippy]
cast_lossless = "warn"
cast_ptr_alignment = "allow" # TODO change to warn or deny when ready to fix
mut_from_ref = "allow"
ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
ref_as_ptr = "warn"
zero_ptr = "warn"
[workspace.lints.rust]
non_camel_case_types = "allow"
unsafe_op_in_unsafe_fn = "deny"
[lints.rust]
non_camel_case_types = "allow"
unsafe_op_in_unsafe_fn = "deny"
[build-dependencies]
cc = "1"
+2 -1
View File
@@ -26,7 +26,8 @@ pub const RTLD_NOLOAD: c_int = 1 << 2;
pub const RTLD_GLOBAL: c_int = 1 << 8;
pub const RTLD_LOCAL: c_int = 0x0000;
pub const RTLD_DEFAULT: *mut c_void = 0 as *mut c_void; // XXX: cbindgen doesn't like ptr::null_mut()
#[allow(clippy::zero_ptr)] // related cbindgen issue: https://github.com/mozilla/cbindgen/issues/948
pub const RTLD_DEFAULT: *mut c_void = 0 as *mut c_void; // XXX: cbindgen doesn't like ptr::null_mut() for publically exported constants
static ERROR_NOT_SUPPORTED: &core::ffi::CStr = c"dlfcn not supported";
+1 -1
View File
@@ -39,7 +39,7 @@ pub struct RTLDDebug {
impl RTLDDebug {
const NEW: Self = RTLDDebug {
r_version: 1,
r_map: 0 as *mut LinkMap,
r_map: ptr::null_mut::<LinkMap>(),
r_brk: _dl_debug_state,
state: RTLDState::RT_CONSISTENT,
r_ldbase: 0,
-14
View File
@@ -8,12 +8,8 @@
#![no_std]
#![allow(warnings)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(unused_variables)]
#![feature(alloc_error_handler)]
#![feature(allocator_api)]
#![feature(asm_const)]
#![feature(c_variadic)]
#![feature(core_intrinsics)]
#![feature(macro_derive)]
@@ -22,22 +18,12 @@
#![feature(linkage)]
#![feature(pointer_is_aligned_to)]
#![feature(ptr_as_uninit)]
#![feature(slice_as_chunks)]
#![feature(slice_ptr_get)]
#![feature(stmt_expr_attributes)]
#![feature(strict_provenance)]
#![feature(sync_unsafe_cell)]
#![feature(thread_local)]
#![feature(vec_into_raw_parts)]
#![feature(negative_impls)]
#![allow(clippy::cast_lossless)]
#![allow(clippy::cast_ptr_alignment)]
#![allow(clippy::derive_hash_xor_eq)]
#![allow(clippy::eval_order_dependence)]
#![allow(clippy::mut_from_ref)]
#![deny(unsafe_op_in_unsafe_fn)]
// TODO: fix these
#![warn(unaligned_references)]
#[macro_use]
extern crate alloc;