From 7f7fbc716b571e9eade984d834e2e0d455f912f1 Mon Sep 17 00:00:00 2001 From: Valentin Huber Date: Thu, 19 Dec 2024 21:34:26 +0000 Subject: [PATCH] Move libafl_concolic to expect instead of allow --- libafl_concolic/symcc_runtime/src/filter.rs | 9 +++++---- .../symcc_runtime/src/filter/coverage.rs | 4 ++-- libafl_concolic/symcc_runtime/src/lib.rs | 14 +++++++------- libafl_concolic/symcc_runtime/src/tracing.rs | 7 +++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/libafl_concolic/symcc_runtime/src/filter.rs b/libafl_concolic/symcc_runtime/src/filter.rs index 6059c93c8d..1b9c2aa690 100644 --- a/libafl_concolic/symcc_runtime/src/filter.rs +++ b/libafl_concolic/symcc_runtime/src/filter.rs @@ -2,6 +2,7 @@ use std::collections::HashSet; +// required for the import the macro `invoke_macro_with_rust_runtime_exports` that is dynamically generated in build.rs #[allow(clippy::wildcard_imports)] use crate::*; @@ -17,19 +18,19 @@ macro_rules! rust_filter_function_declaration { // push_path_constraint is not caught by the following case (because it has not return value), // but still needs to return something (pub fn push_path_constraint($( $arg:ident : $type:ty ),*$(,)?), $c_name:ident;) => { - #[allow(unused_variables)] + #[allow(unused_variables)] // only unused for some macro invocations fn push_path_constraint(&mut self, $($arg : $type),*) -> bool { true } }; (pub fn $name:ident($( $arg:ident : $type:ty ),*$(,)?) -> $ret:ty, $c_name:ident;) => { - #[allow(unused_variables)] + #[allow(unused_variables)] // only unused for some macro invocations fn $name(&mut self, $( $arg : $type),*) -> bool {true} }; (pub fn $name:ident($( $arg:ident : $type:ty ),*$(,)?), $c_name:ident;) => { - #[allow(unused_variables)] + #[allow(unused_variables)] // only unused for some macro invocations fn $name(&mut self, $( $arg : $type),*) {} }; } @@ -84,7 +85,7 @@ pub trait Filter { /// /// It applies the filter before passing expressions to the inner runtime. /// It also implements [`Runtime`], allowing for composing multiple [`Filter`]'s in a chain. -#[allow(clippy::module_name_repetitions)] +#[expect(clippy::module_name_repetitions)] pub struct FilterRuntime { filter: F, runtime: RT, diff --git a/libafl_concolic/symcc_runtime/src/filter/coverage.rs b/libafl_concolic/symcc_runtime/src/filter/coverage.rs index 1a56557a93..1d5e907abd 100644 --- a/libafl_concolic/symcc_runtime/src/filter/coverage.rs +++ b/libafl_concolic/symcc_runtime/src/filter/coverage.rs @@ -70,7 +70,6 @@ impl CallStackCoverage bool { self.is_interesting } @@ -139,6 +138,7 @@ macro_rules! call_stack_coverage_filter_function_implementation { }; } +// required for the import the macro `invoke_macro_with_rust_runtime_exports` that is dynamically generated in build.rs #[allow(clippy::wildcard_imports)] use crate::*; @@ -189,7 +189,7 @@ where } fn register_location_on_hitmap(&mut self, location: usize) { - #[allow(clippy::cast_possible_truncation)] // we cannot have more than usize elements.. + #[expect(clippy::cast_possible_truncation)] // we cannot have more than usize elements.. let hash = (self.build_hasher.hash_one(location) % usize::MAX as u64) as usize; let val = unsafe { // # Safety diff --git a/libafl_concolic/symcc_runtime/src/lib.rs b/libafl_concolic/symcc_runtime/src/lib.rs index 7caea28316..7746364cb6 100644 --- a/libafl_concolic/symcc_runtime/src/lib.rs +++ b/libafl_concolic/symcc_runtime/src/lib.rs @@ -135,7 +135,7 @@ macro_rules! unwrap_option { macro_rules! export_rust_runtime_fn { // special case for expression_unreachable, because we need to be convert pointer+length to slice (pub fn expression_unreachable(expressions: *mut RSymExpr, num_elements: usize), $c_name:ident; $rt_cb:path) => { - #[allow(clippy::missing_safety_doc)] + #[expect(clippy::missing_safety_doc)] #[no_mangle] pub unsafe extern "C" fn _rsym_expression_unreachable(expressions: *mut RSymExpr, num_elements: usize) { let slice = core::slice::from_raw_parts(expressions, num_elements); @@ -146,7 +146,7 @@ macro_rules! export_rust_runtime_fn { }; // special case for push_path_constraint, we are not returning a new expression while taking an expression as argument (pub fn push_path_constraint(constraint: RSymExpr, taken: bool, site_id: usize), $c_name:ident; $rt_cb:path) => { - #[allow(clippy::missing_safety_doc)] + #[expect(clippy::missing_safety_doc)] #[no_mangle] pub unsafe extern "C" fn _rsym_push_path_constraint(constraint: Option, taken: bool, site_id: usize) { if let Some(constraint) = constraint { @@ -160,7 +160,7 @@ macro_rules! export_rust_runtime_fn { (pub fn build_integer_from_buffer( buffer: *mut ::std::os::raw::c_void, num_bits: ::std::os::raw::c_uint$(,)?) -> RSymExpr,$c_name:ident; $rt_cb:path) => { - #[allow(clippy::missing_safety_doc)] + #[expect(clippy::missing_safety_doc)] #[no_mangle] pub unsafe extern "C" fn _rsym_build_integer_from_buffer(buffer: *mut ::std::os::raw::c_void, num_bits: ::std::os::raw::c_uint) { $rt_cb(|rt| { @@ -170,7 +170,7 @@ macro_rules! export_rust_runtime_fn { }; // all other methods are handled by this (pub fn $name:ident($( $arg:ident : $(::)?$($type:ident)::+ ),*$(,)?)$( -> $($ret:ident)::+)?, $c_name:ident; $rt_cb:path) => { - #[allow(clippy::missing_safety_doc)] + #[expect(clippy::missing_safety_doc)] #[no_mangle] pub unsafe extern "C" fn $c_name( $($arg: $crate::make_symexpr_optional!($($type)::+),)* )$( -> $crate::make_symexpr_optional!($($ret)::+))? { $rt_cb(|rt| { @@ -185,12 +185,12 @@ macro_rules! export_rust_runtime_fn { macro_rules! impl_nop_runtime_fn { // special case for expression_unreachable, because it has a different signature in our runtime trait than in the c interface. (pub fn expression_unreachable(expressions: *mut RSymExpr, num_elements: usize), $c_name:ident;) => { - #[allow(clippy::default_trait_access)] + // #[expect(clippy::default_trait_access)] fn expression_unreachable(&mut self, _exprs: &[RSymExpr]) {std::default::Default::default()} }; (pub fn $name:ident($( $arg:ident : $type:ty ),*$(,)?)$( -> $ret:ty)?, $c_name:ident;) => { - #[allow(clippy::default_trait_access)] + // #[expect(clippy::default_trait_access)] fn $name(&mut self, $( _ : $type),*)$( -> Option<$ret>)? {std::default::Default::default()} }; } @@ -222,7 +222,7 @@ impl OptionalRuntime { macro_rules! rust_runtime_function_declaration { (pub fn expression_unreachable(expressions: *mut RSymExpr, num_elements: usize), $c_name:ident;) => { - #[allow(clippy::default_trait_access)] + // #[expect(clippy::default_trait_access)] fn expression_unreachable(&mut self, exprs: &[RSymExpr]) { if let Some(inner) = &mut self.inner { inner.expression_unreachable(exprs); diff --git a/libafl_concolic/symcc_runtime/src/tracing.rs b/libafl_concolic/symcc_runtime/src/tracing.rs index 428b194d12..d456407340 100644 --- a/libafl_concolic/symcc_runtime/src/tracing.rs +++ b/libafl_concolic/symcc_runtime/src/tracing.rs @@ -25,7 +25,7 @@ impl TracingRuntime { } } - #[allow(clippy::unnecessary_wraps)] + #[expect(clippy::unnecessary_wraps)] fn write_message(&mut self, message: SymExpr) -> Option { Some(self.writer.write_message(message).unwrap()) } @@ -35,14 +35,14 @@ impl TracingRuntime { /// according to [`concolic::SymExpr`]. macro_rules! expression_builder { ($method_name:ident ( $($param_name:ident : $param_type:ty ),+ ) => $message:ident) => { - #[allow(clippy::missing_safety_doc)] + // #[expect(clippy::missing_safety_doc)] #[no_mangle] fn $method_name(&mut self, $( $param_name : $param_type, )+ ) -> Option { self.write_message(SymExpr::$message { $($param_name,)+ }) } }; ($method_name:ident () => $message:ident) => { - #[allow(clippy::missing_safety_doc)] + // #[expect(clippy::missing_safety_doc)] #[no_mangle] fn $method_name(&mut self) -> Option { self.write_message(SymExpr::$message) @@ -63,7 +63,6 @@ macro_rules! binary_expression_builder { } impl Runtime for TracingRuntime { - #[allow(clippy::missing_safety_doc)] #[no_mangle] fn build_integer_from_buffer( &mut self,