diff --git a/libafl/src/mutators/mutations.rs b/libafl/src/mutators/mutations.rs index bd279cc0c2..c2dff328ce 100644 --- a/libafl/src/mutators/mutations.rs +++ b/libafl/src/mutators/mutations.rs @@ -50,9 +50,7 @@ pub(crate) unsafe fn buffer_copy(dst: &mut [T], src: &[T], from: usize, to: u #[inline] pub fn buffer_set(data: &mut [T], from: usize, len: usize, val: T) { debug_assert!(from + len <= data.len()); - for p in &mut data[from..(from + len)] { - *p = val.clone(); - } + data[from..(from + len)].fill(val); } /// Generate a range of values where (upon repeated calls) each index is likely to appear in the @@ -353,7 +351,7 @@ impl ByteRandMutator { // within the input are treated as u8, u16, u32, or u64, then mutated in place. macro_rules! add_mutator_impl { ($name: ident, $size: ty) => { - /// Adds or subtracts a random value up to `ARITH_MAX` to a [`<$size>`] at a random place in the [`Vec`], in random byte order. + #[doc = concat!("Adds or subtracts a random value up to `ARITH_MAX` to a [`", stringify!($size), "`] at a random place in the [`Vec`], in random byte order.")] #[derive(Default, Debug)] pub struct $name; @@ -402,7 +400,7 @@ macro_rules! add_mutator_impl { } impl $name { - /// Creates a new [`$name`]. + #[doc = concat!("Creates a new [`", stringify!($name), "`].")] #[must_use] pub fn new() -> Self { Self @@ -460,7 +458,7 @@ macro_rules! interesting_mutator_impl { } impl $name { - /// Creates a new [`$name`]. + #[doc = concat!("Creates a new [`", stringify!($name), "`].")] #[must_use] pub fn new() -> Self { Self diff --git a/libafl/src/schedulers/minimizer.rs b/libafl/src/schedulers/minimizer.rs index 295c0a9a62..d829af4a25 100644 --- a/libafl/src/schedulers/minimizer.rs +++ b/libafl/src/schedulers/minimizer.rs @@ -101,7 +101,7 @@ where self.update_score(state, idx) } - /// Removes an entry from the corpus, returning M if M was present. + /// Removes an entry from the corpus fn on_remove( &mut self, state: &mut CS::State, @@ -252,7 +252,7 @@ where M: AsSlice + SerdeAny + HasRefCnt, CS::State: HasCorpus + HasMetadata + HasRand, { - /// Update the `Corpus` score using the `MinimizerScheduler` + /// Update the [`Corpus`] score using the [`MinimizerScheduler`] #[allow(clippy::unused_self)] #[allow(clippy::cast_possible_wrap)] pub fn update_score(&self, state: &mut CS::State, idx: CorpusId) -> Result<(), Error> { @@ -327,7 +327,7 @@ where Ok(()) } - /// Cull the `Corpus` using the `MinimizerScheduler` + /// Cull the [`Corpus`] using the [`MinimizerScheduler`] #[allow(clippy::unused_self)] pub fn cull(&self, state: &CS::State) -> Result<(), Error> { let Some(top_rated) = state.metadata_map().get::() else {