Skip to content

Commit 9eea795

Browse files
committed
moving from generic to associated type to reduce code duplication
1 parent aa59442 commit 9eea795

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

libafl/src/mutators/havoc_mutations.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,10 @@ mod tests {
285285
&self.vec
286286
}
287287
}
288-
impl DefaultMutators<MappedHavocMutationsType<Self, MutVecInput<'static>, &'static [u8]>>
289-
for CustomInput
290-
{
291-
fn default_mutators(
292-
) -> MappedHavocMutationsType<Self, MutVecInput<'static>, &'static [u8]> {
288+
impl DefaultMutators for CustomInput {
289+
type Type = MappedHavocMutationsType<Self, MutVecInput<'static>, &'static [u8]>;
290+
291+
fn default_mutators() -> Self::Type {
293292
mapped_havoc_mutations(Self::vec_mut, Self::vec)
294293
}
295294
}

libafl/src/mutators/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,10 @@ impl Named for NopMutator {
399399
}
400400

401401
/// Extensions of [`crate::inputs::Input`]s that have default mutators
402-
pub trait DefaultMutators<MT> {
402+
pub trait DefaultMutators {
403+
/// The resulting mutator list type
404+
type Type;
403405
/// Get the default mutators for this type
404406
#[must_use]
405-
fn default_mutators() -> MT;
407+
fn default_mutators() -> Self::Type;
406408
}

0 commit comments

Comments
 (0)