Make clippy happy

This commit is contained in:
René Kijewski 2024-08-18 01:40:12 +02:00
parent 8433e24917
commit 79873f6a17
2 changed files with 9 additions and 8 deletions

View File

@ -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();

View File

@ -4,14 +4,14 @@ pub mod parser;
use std::error::Error;
use std::fmt;
pub const TARGETS: &[(
&str,
for<'a> fn(&'a [u8]) -> Result<NamedTarget<'a>, Box<dyn Error + Send + 'static>>,
)] = &[
pub const TARGETS: &[(&str, TargetBuilder)] = &[
("html", |data| NamedTarget::new::<html::Scenario>(data)),
("parser", |data| NamedTarget::new::<parser::Scenario>(data)),
];
pub type TargetBuilder =
for<'a> fn(&'a [u8]) -> Result<NamedTarget<'a>, Box<dyn Error + Send + 'static>>;
pub trait Scenario<'a>: fmt::Debug + Sized {
type NewError: Error + Send + 'static;
type RunError: Error + Send + 'static;