more cargo fixes
This commit is contained in:
parent
0ac48c2e0b
commit
d72d48d6a8
14
clippy.sh
14
clippy.sh
@ -3,13 +3,19 @@
|
|||||||
cargo clean
|
cargo clean
|
||||||
RUST_BACKTRACE=full cargo clippy --all -- \
|
RUST_BACKTRACE=full cargo clippy --all -- \
|
||||||
-D clippy::pedantic \
|
-D clippy::pedantic \
|
||||||
-W missing-docs \
|
-W clippy::cast_sign_loss \
|
||||||
-W clippy::missing-errors-doc \
|
|
||||||
-W clippy::similar-names \
|
-W clippy::similar-names \
|
||||||
|
-W clippy::cast_ptr_alignment \
|
||||||
|
-A missing-docs \
|
||||||
|
-A clippy::doc_markdown \
|
||||||
|
-A clippy::must-use-candidate \
|
||||||
|
-A clippy::missing-errors-doc \
|
||||||
|
-A clippy::cast-possible-truncation \
|
||||||
|
-A clippy::used-underscore-binding \
|
||||||
|
-A clippy::ptr-as-ptr \
|
||||||
|
-A clippy::missing-panics-doc \
|
||||||
-A clippy::missing-docs-in-private-items \
|
-A clippy::missing-docs-in-private-items \
|
||||||
-A clippy::unseparated-literal-suffix \
|
-A clippy::unseparated-literal-suffix \
|
||||||
-A clippy::module-name-repetitions \
|
-A clippy::module-name-repetitions \
|
||||||
-A clippy::unreadable-literal \
|
-A clippy::unreadable-literal \
|
||||||
-A clippy::if-not-else \
|
-A clippy::if-not-else \
|
||||||
#--allow clippy::print-with-newline \
|
|
||||||
#--allow clippy::write-with-newline \
|
|
||||||
|
@ -86,7 +86,7 @@ use std::os::unix::{
|
|||||||
{io::AsRawFd, prelude::RawFd},
|
{io::AsRawFd, prelude::RawFd},
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "llmp_debug")]
|
#[cfg(all(feature = "llmp_debug", feature = "std"))]
|
||||||
use backtrace::Backtrace;
|
use backtrace::Backtrace;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "std"))]
|
#[cfg(all(unix, feature = "std"))]
|
||||||
@ -788,9 +788,12 @@ where
|
|||||||
|
|
||||||
/// listener about it using a EOP message.
|
/// listener about it using a EOP message.
|
||||||
unsafe fn handle_out_eop(&mut self) -> Result<(), Error> {
|
unsafe fn handle_out_eop(&mut self) -> Result<(), Error> {
|
||||||
#[cfg(feature = "llmp_debug")]
|
#[cfg(all(feature = "llmp_debug", feature = "std"))]
|
||||||
{
|
{
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
let bt = Backtrace::new();
|
let bt = Backtrace::new();
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
let bt = "<n/a (release)>";
|
||||||
let shm = self.out_maps.last().unwrap();
|
let shm = self.out_maps.last().unwrap();
|
||||||
println!(
|
println!(
|
||||||
"LLMP_DEBUG: End of page reached for map {} with len {}, sending EOP, bt: {:?}",
|
"LLMP_DEBUG: End of page reached for map {} with len {}, sending EOP, bt: {:?}",
|
||||||
@ -1039,7 +1042,7 @@ where
|
|||||||
// Mark the new page save to unmap also (it's mapped by us, the broker now)
|
// Mark the new page save to unmap also (it's mapped by us, the broker now)
|
||||||
ptr::write_volatile(&mut (*page).save_to_unmap, 1);
|
ptr::write_volatile(&mut (*page).save_to_unmap, 1);
|
||||||
|
|
||||||
#[cfg(feature = "llmp_debug")]
|
#[cfg(all(feature = "llmp_debug", feature = "std"))]
|
||||||
println!(
|
println!(
|
||||||
"LLMP_DEBUG: Got a new recv map {} with len {:?}",
|
"LLMP_DEBUG: Got a new recv map {} with len {:?}",
|
||||||
self.current_recv_map.shmem.shm_str(),
|
self.current_recv_map.shmem.shm_str(),
|
||||||
@ -1154,7 +1157,7 @@ where
|
|||||||
{
|
{
|
||||||
/// Creates a new page, initializing the passed shared mem struct
|
/// Creates a new page, initializing the passed shared mem struct
|
||||||
pub fn new(sender: u32, mut new_map: SH) -> Self {
|
pub fn new(sender: u32, mut new_map: SH) -> Self {
|
||||||
#[cfg(feature = "llmp_debug")]
|
#[cfg(all(feature = "llmp_debug", feature = "std"))]
|
||||||
println!(
|
println!(
|
||||||
"LLMP_DEBUG: Initializing map on {} with size {}",
|
"LLMP_DEBUG: Initializing map on {} with size {}",
|
||||||
new_map.shm_str(),
|
new_map.shm_str(),
|
||||||
@ -1169,9 +1172,12 @@ where
|
|||||||
|
|
||||||
/// Maps and wraps an existing
|
/// Maps and wraps an existing
|
||||||
pub fn existing(existing_map: SH) -> Self {
|
pub fn existing(existing_map: SH) -> Self {
|
||||||
#[cfg(feature = "llmp_debug")]
|
#[cfg(all(feature = "llmp_debug", feature = "std"))]
|
||||||
{
|
{
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
let bt = Backtrace::new();
|
let bt = Backtrace::new();
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
let bt = "<n/a (release)>";
|
||||||
println!(
|
println!(
|
||||||
"LLMP_DEBUG: Using existing map {} with size {}, bt: {:?}",
|
"LLMP_DEBUG: Using existing map {} with size {}, bt: {:?}",
|
||||||
existing_map.shm_str(),
|
existing_map.shm_str(),
|
||||||
|
@ -49,7 +49,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A simple executor that does nothing.
|
/// A simple executor that does nothing.
|
||||||
/// If intput len is 0, run_target will return Err
|
/// If intput len is 0, `run_target` will return Err
|
||||||
struct NopExecutor<I> {
|
struct NopExecutor<I> {
|
||||||
phantom: PhantomData<I>,
|
phantom: PhantomData<I>,
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//! A TimeoutExecutor set a timeout before each target run
|
//! A `TimeoutExecutor` sets a timeout before each target run
|
||||||
|
|
||||||
use core::{marker::PhantomData, time::Duration};
|
use core::{marker::PhantomData, time::Duration};
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ where
|
|||||||
R: Reducer<T>,
|
R: Reducer<T>,
|
||||||
O: MapObserver<T> + Observer,
|
O: MapObserver<T> + Observer,
|
||||||
{
|
{
|
||||||
/// Create new MapFeedback
|
/// Create new `MapFeedback`
|
||||||
pub fn new(name: &'static str, map_size: usize) -> Self {
|
pub fn new(name: &'static str, map_size: usize) -> Self {
|
||||||
Self {
|
Self {
|
||||||
history_map: vec![T::default(); map_size],
|
history_map: vec![T::default(); map_size],
|
||||||
@ -270,7 +270,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create new MapFeedback for the observer type.
|
/// Create new `MapFeedback` for the observer type.
|
||||||
pub fn new_with_observer(map_observer: &O) -> Self {
|
pub fn new_with_observer(map_observer: &O) -> Self {
|
||||||
Self {
|
Self {
|
||||||
history_map: vec![T::default(); map_observer.map().len()],
|
history_map: vec![T::default(); map_observer.map().len()],
|
||||||
@ -281,7 +281,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create new MapFeedback specifying if it must track indexes of novelties
|
/// Create new `MapFeedback` specifying if it must track indexes of novelties
|
||||||
pub fn new_track(
|
pub fn new_track(
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
map_size: usize,
|
map_size: usize,
|
||||||
@ -297,7 +297,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create new MapFeedback for the observer type if it must track indexes of novelties
|
/// Create new `MapFeedback` for the observer type if it must track indexes of novelties
|
||||||
pub fn new_with_observer_track(
|
pub fn new_with_observer_track(
|
||||||
map_observer: &O,
|
map_observer: &O,
|
||||||
track_indexes: bool,
|
track_indexes: bool,
|
||||||
@ -319,7 +319,7 @@ where
|
|||||||
R: Reducer<T>,
|
R: Reducer<T>,
|
||||||
O: MapObserver<T>,
|
O: MapObserver<T>,
|
||||||
{
|
{
|
||||||
/// Create new MapFeedback using a map observer, and a map.
|
/// Create new `MapFeedback` using a map observer, and a map.
|
||||||
/// The map can be shared.
|
/// The map can be shared.
|
||||||
pub fn with_history_map(name: &'static str, history_map: Vec<T>) -> Self {
|
pub fn with_history_map(name: &'static str, history_map: Vec<T>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -24,7 +24,7 @@ pub trait Feedback<I>: Named + serde::Serialize + serde::de::DeserializeOwned +
|
|||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
{
|
{
|
||||||
/// is_interesting should return the "Interestingness" from 0 to 255 (percent times 2.55)
|
/// `is_interesting ` should return the "Interestingness" from 0 to 255 (percent times 2.55)
|
||||||
fn is_interesting<OT: ObserversTuple>(
|
fn is_interesting<OT: ObserversTuple>(
|
||||||
&mut self,
|
&mut self,
|
||||||
input: &I,
|
input: &I,
|
||||||
|
@ -96,7 +96,7 @@ pub trait Fuzzer<E, EM, S, CS> {
|
|||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given the last time, if stats_timeout seconds passed, send off an info/stats/heartbeat message to the broker.
|
/// Given the last time, if `stats_timeout` seconds passed, send off an info/stats/heartbeat message to the broker.
|
||||||
/// Returns the new `last` time (so the old one, unless `stats_timeout` time has passed and stats have been sent)
|
/// Returns the new `last` time (so the old one, unless `stats_timeout` time has passed and stats have been sent)
|
||||||
/// Will return an Error, if the stats could not be sent.
|
/// Will return an Error, if the stats could not be sent.
|
||||||
fn maybe_report_stats(
|
fn maybe_report_stats(
|
||||||
|
@ -48,7 +48,7 @@ where
|
|||||||
Ok(BytesInput::new(random_bytes))
|
Ok(BytesInput::new(random_bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates up to DUMMY_BYTES_MAX non-random dummy bytes (0)
|
/// Generates up to `DUMMY_BYTES_MAX` non-random dummy bytes (0)
|
||||||
fn generate_dummy(&self) -> BytesInput {
|
fn generate_dummy(&self) -> BytesInput {
|
||||||
let size = min(self.max_size, DUMMY_BYTES_MAX);
|
let size = min(self.max_size, DUMMY_BYTES_MAX);
|
||||||
BytesInput::new(vec![0; size])
|
BytesInput::new(vec![0; size])
|
||||||
@ -90,7 +90,7 @@ where
|
|||||||
Ok(BytesInput::new(random_bytes))
|
Ok(BytesInput::new(random_bytes))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Generates up to DUMMY_BYTES_MAX non-random dummy bytes (0)
|
/// Generates up to `DUMMY_BYTES_MAX` non-random dummy bytes (0)
|
||||||
fn generate_dummy(&self) -> BytesInput {
|
fn generate_dummy(&self) -> BytesInput {
|
||||||
let size = min(self.max_size, DUMMY_BYTES_MAX);
|
let size = min(self.max_size, DUMMY_BYTES_MAX);
|
||||||
BytesInput::new(vec![0_u8; size])
|
BytesInput::new(vec![0_u8; size])
|
||||||
|
@ -44,7 +44,7 @@ pub fn buffer_copy(dst: &mut [u8], src: &[u8], from: usize, to: usize, len: usiz
|
|||||||
|
|
||||||
/// A simple buffer_set.
|
/// A simple buffer_set.
|
||||||
/// The compiler does the heavy lifting.
|
/// The compiler does the heavy lifting.
|
||||||
/// see https://stackoverflow.com/a/51732799/1345238
|
/// see <https://stackoverflow.com/a/51732799/1345238/>
|
||||||
#[inline]
|
#[inline]
|
||||||
fn buffer_set(data: &mut [u8], from: usize, len: usize, val: u8) {
|
fn buffer_set(data: &mut [u8], from: usize, len: usize, val: u8) {
|
||||||
debug_assert!(from + len <= data.len());
|
debug_assert!(from + len <= data.len());
|
||||||
|
@ -402,7 +402,7 @@ impl ChildHandle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
/// The ForkResult
|
/// The `ForkResult` (result of a fork)
|
||||||
pub enum ForkResult {
|
pub enum ForkResult {
|
||||||
Parent(ChildHandle),
|
Parent(ChildHandle),
|
||||||
Child,
|
Child,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user