diff --git a/fuzzing/fuzz/src/html/mod.rs b/fuzzing/fuzz/src/html/mod.rs index 524af0d6..a9d87034 100644 --- a/fuzzing/fuzz/src/html/mod.rs +++ b/fuzzing/fuzz/src/html/mod.rs @@ -1,9 +1,10 @@ +#[allow(clippy::module_inception)] mod html; use arbitrary::{Arbitrary, Unstructured}; use html_escape::decode_html_entities_to_string; -#[derive(Arbitrary, Debug)] +#[derive(Arbitrary, Debug, Clone, Copy)] pub enum Scenario<'a> { String(&'a str), Char(char), @@ -19,8 +20,8 @@ impl<'a> super::Scenario<'a> for Scenario<'a> { } fn run(&self) -> Result<(), Self::RunError> { - match self { - &Scenario::String(src) => { + match *self { + Scenario::String(src) => { let mut dest = String::with_capacity(src.len()); html::write_escaped_str(&mut dest, src).unwrap(); @@ -28,7 +29,7 @@ impl<'a> super::Scenario<'a> for Scenario<'a> { let unescaped = decode_html_entities_to_string(dest, &mut unescaped); assert_eq!(src, unescaped); } - &Scenario::Char(c) => { + Scenario::Char(c) => { let mut dest = String::with_capacity(6); html::write_escaped_char(&mut dest, c).unwrap(); diff --git a/fuzzing/fuzz/src/lib.rs b/fuzzing/fuzz/src/lib.rs index 40ee15ea..999d535c 100644 --- a/fuzzing/fuzz/src/lib.rs +++ b/fuzzing/fuzz/src/lib.rs @@ -4,14 +4,14 @@ pub mod parser; use std::error::Error; use std::fmt; -pub const TARGETS: &[( - &str, - for<'a> fn(&'a [u8]) -> Result, Box>, -)] = &[ +pub const TARGETS: &[(&str, TargetBuilder)] = &[ ("html", |data| NamedTarget::new::(data)), ("parser", |data| NamedTarget::new::(data)), ]; +pub type TargetBuilder = + for<'a> fn(&'a [u8]) -> Result, Box>; + pub trait Scenario<'a>: fmt::Debug + Sized { type NewError: Error + Send + 'static; type RunError: Error + Send + 'static;