Skip to content

Commit

Permalink
Re-add some necessary allows
Browse files Browse the repository at this point in the history
  • Loading branch information
riesentoaster committed Dec 19, 2024
1 parent 5c0c8d8 commit 6509b51
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 32 deletions.
12 changes: 4 additions & 8 deletions libafl_bolts/src/core_affinity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,6 @@ mod windows {
}
}

#[expect(trivial_numeric_casts)]
#[expect(clippy::cast_ptr_alignment)]
#[expect(clippy::cast_possible_wrap)]
pub fn get_num_logical_cpus_ex_windows() -> Option<usize> {
Expand All @@ -469,17 +468,16 @@ mod windows {
const RelationProcessorCore: u32 = 0;

#[repr(C)]
#[expect(non_camel_case_types)]
#[expect(dead_code)]
#[allow(non_camel_case_types)] // expect breaks for some reason
struct GROUP_AFFINITY {
mask: usize,
group: u16,
reserved: [u16; 3],
}

#[repr(C)]
#[expect(non_camel_case_types)]
#[expect(dead_code)]
#[allow(non_camel_case_types)] // expect breaks for some reason

struct PROCESSOR_RELATIONSHIP {
flags: u8,
efficiency_class: u8,
Expand All @@ -489,8 +487,7 @@ mod windows {
}

#[repr(C)]
#[expect(non_camel_case_types)]
#[expect(dead_code)]
#[allow(non_camel_case_types)] // expect breaks for some reason
struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX {
relationship: u32,
size: u32,
Expand Down Expand Up @@ -625,7 +622,6 @@ mod apple {
) -> kern_return_t;
}

#[expect(clippy::unnecessary_wraps)]
pub fn get_core_ids() -> Result<Vec<CoreId>, Error> {
Ok((0..(usize::from(available_parallelism()?)))
.map(CoreId)
Expand Down
4 changes: 4 additions & 0 deletions libafl_bolts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,24 +608,28 @@ impl From<VarError> for Error {
}

impl From<ParseIntError> for Error {
#[allow(unused_variables)] // err is used without std
fn from(err: ParseIntError) -> Self {
Self::unknown(format!("Failed to parse Int: {err:?}"))
}
}

impl From<TryFromIntError> for Error {
#[allow(unused_variables)] // err is used without std
fn from(err: TryFromIntError) -> Self {
Self::illegal_state(format!("Expected conversion failed: {err:?}"))
}
}

impl From<TryFromSliceError> for Error {
#[allow(unused_variables)] // err is used without std
fn from(err: TryFromSliceError) -> Self {
Self::illegal_argument(format!("Could not convert slice: {err:?}"))
}
}

impl From<SetLoggerError> for Error {
#[allow(unused_variables)] // err is used without std
fn from(err: SetLoggerError) -> Self {
Self::illegal_state(format!("Failed to register logger: {err:?}"))
}
Expand Down
19 changes: 0 additions & 19 deletions libafl_bolts/src/minibsod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(any(target_os = "linux", target_os = "android"), target_arch = "x86"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand Down Expand Up @@ -143,7 +142,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_os = "freebsd", target_arch = "aarch64"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand All @@ -167,7 +165,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_vendor = "apple", target_arch = "aarch64"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand Down Expand Up @@ -227,7 +224,6 @@ pub fn dump_registers<W: Write>(
any(target_os = "freebsd", target_os = "dragonfly"),
target_arch = "x86_64"
))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand Down Expand Up @@ -257,7 +253,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_os = "netbsd", target_arch = "x86_64"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand Down Expand Up @@ -367,7 +362,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_os = "openbsd", target_arch = "x86_64"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand Down Expand Up @@ -395,7 +389,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_os = "openbsd", target_arch = "aarch64"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand All @@ -418,7 +411,6 @@ pub fn dump_registers<W: Write>(
any(target_os = "solaris", target_os = "illumos"),
target_arch = "x86_64"
))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand Down Expand Up @@ -454,7 +446,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_os = "windows", target_arch = "x86_64"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
context: &CONTEXT,
Expand Down Expand Up @@ -483,7 +474,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_os = "windows", target_arch = "x86"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
context: &CONTEXT,
Expand All @@ -503,7 +493,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_os = "windows", target_arch = "aarch64"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
context: &CONTEXT,
Expand All @@ -530,7 +519,6 @@ pub fn dump_registers<W: Write>(

/// Write the content of all important registers
#[cfg(all(target_os = "haiku", target_arch = "x86_64"))]
#[expect(clippy::similar_names)]
pub fn dump_registers<W: Write>(
writer: &mut BufWriter<W>,
ucontext: &ucontext_t,
Expand Down Expand Up @@ -669,7 +657,6 @@ fn write_crash<W: Write>(
}

#[cfg(all(target_vendor = "apple", target_arch = "aarch64"))]
#[expect(clippy::similar_names)]
fn write_crash<W: Write>(
writer: &mut BufWriter<W>,
signal: Signal,
Expand All @@ -686,7 +673,6 @@ fn write_crash<W: Write>(
}

#[cfg(all(target_vendor = "apple", target_arch = "x86_64"))]
#[expect(clippy::similar_names)]
fn write_crash<W: Write>(
writer: &mut BufWriter<W>,
signal: Signal,
Expand All @@ -708,7 +694,6 @@ fn write_crash<W: Write>(
}

#[cfg(all(target_os = "freebsd", target_arch = "x86_64"))]
#[expect(clippy::similar_names)]
fn write_crash<W: Write>(
writer: &mut BufWriter<W>,
signal: Signal,
Expand All @@ -724,7 +709,6 @@ fn write_crash<W: Write>(
}

#[cfg(all(target_os = "dragonfly", target_arch = "x86_64"))]
#[expect(clippy::similar_names)]
fn write_crash<W: Write>(
writer: &mut BufWriter<W>,
signal: Signal,
Expand All @@ -740,7 +724,6 @@ fn write_crash<W: Write>(
}

#[cfg(all(target_os = "openbsd", target_arch = "x86_64"))]
#[expect(clippy::similar_names)]
fn write_crash<W: Write>(
writer: &mut BufWriter<W>,
signal: Signal,
Expand All @@ -756,7 +739,6 @@ fn write_crash<W: Write>(
}

#[cfg(all(target_os = "openbsd", target_arch = "aarch64"))]
#[expect(clippy::similar_names)]
fn write_crash<W: Write>(
writer: &mut BufWriter<W>,
signal: Signal,
Expand Down Expand Up @@ -1002,7 +984,6 @@ fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Er
}

#[cfg(target_vendor = "apple")]
#[expect(non_camel_case_types)]
fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Error> {
let mut ptask = std::mem::MaybeUninit::<mach_port_t>::uninit();
// We start by the lowest virtual address from the userland' standpoint
Expand Down
12 changes: 7 additions & 5 deletions libafl_bolts/src/os/unix_signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ pub struct ucontext_t {
#[derive(Debug)]
#[repr(C)]
#[expect(clippy::pub_underscore_fields)]
#[allow(non_camel_case_types)] // expect breaks for some reason
pub struct arm_exception_state64 {
/// Virtual Fault Address
pub __far: u64,
Expand All @@ -132,6 +133,7 @@ pub struct arm_exception_state64 {
#[derive(Debug)]
#[repr(C)]
#[expect(clippy::pub_underscore_fields)]
#[allow(non_camel_case_types)] // expect breaks for some reason
pub struct arm_thread_state64 {
/// General purpose registers x0-x28
pub __x: [u64; 29],
Expand All @@ -157,9 +159,9 @@ pub struct arm_thread_state64 {
/// ````
#[cfg(all(target_vendor = "apple", target_arch = "aarch64"))]
#[derive(Debug)]
#[expect(non_camel_case_types)]
#[repr(C, align(16))]
//#[repr(align(16))]
#[allow(non_camel_case_types)] // expect breaks for some reason
//#[repr(align(16))]
pub struct arm_neon_state64 {
/// opaque
pub opaque: [u8; (32 * 16) + (2 * size_of::<u32>())],
Expand All @@ -174,10 +176,10 @@ pub struct arm_neon_state64 {
///};
/// ```
#[cfg(all(target_vendor = "apple", target_arch = "aarch64"))]
#[expect(non_camel_case_types)]
#[derive(Debug)]
#[repr(C)]
#[expect(clippy::pub_underscore_fields)]
#[allow(non_camel_case_types)] // expect breaks for some reason
pub struct mcontext64 {
/// `_STRUCT_ARM_EXCEPTION_STATE64`
pub __es: arm_exception_state64,
Expand All @@ -197,8 +199,8 @@ pub struct mcontext64 {
/// ```
#[cfg(all(target_vendor = "apple", target_arch = "aarch64"))]
#[derive(Debug)]
#[expect(non_camel_case_types)]
#[repr(C)]
#[allow(non_camel_case_types)] // expect breaks for some reason
pub struct sigaltstack {
/// signal stack base
pub ss_sp: *mut c_void,
Expand Down Expand Up @@ -226,8 +228,8 @@ pub struct sigaltstack {
/// ```
#[cfg(all(target_vendor = "apple", target_arch = "aarch64"))]
#[derive(Debug)]
#[expect(non_camel_case_types)]
#[repr(C)]
#[allow(non_camel_case_types)] // expect breaks for some reason
pub struct ucontext_t {
/// onstack
pub uc_onstack: c_int,
Expand Down
1 change: 1 addition & 0 deletions libafl_bolts/src/shmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ pub mod unix_shmem {
}
}

#[expect(clippy::unnecessary_wraps)]
fn shmem_from_id_and_size(id: ShMemId, map_size: usize) -> Result<Self, Error> {
// # Safety
// No user-provided potentially unsafe parameters.
Expand Down

0 comments on commit 6509b51

Please sign in to comment.